Is there a more efficient way to render HTML files without constantly needing them to have different names? I'm looking for a method where handlebars can identify which file in which folder to render, without encountering conflicts with files of the same name. Any assistance on this matter would be greatly appreciated. Here's a snippet of code. Thanks!
//Setting up configuration views here //
const hbs = exphbs.create({ helpers, defaultLayout: 'main', extname: '.handlebars' });
app.engine('handlebars', hbs.engine);
//Handlebar files must be named differently //
app.set('views', [
path.join(__dirname, 'views/corporate'),
path.join(__dirname, 'views/help-center'),
]);
app.set('view engine', 'handlebars');
This is my view folder:
https://i.stack.imgur.com/9QqrH.png
Here's an example of one of my routes:
const router = require("express").Router();
const config = require("../../lib/config");
const { appUrl } = config;
router.get("/", (req, res) => {
res.render("corpIndex", {
appUrl
});
});
module.exports = router;