Pass an include parameter in Pug template from ExpressJS?
I'm new to Pug and ExpressJS and can't figure out how to do a simple thing: passing a template path from Express to Pug.
Here's an example of what I have in mind, with the variable named pageContent
:
./app.js
app.get('/', function (req, res) {
res.render('index', {title: 'Some Title', pageContent: 'includes/somePage.html'})
})
./views/index.pug
html
head
include includes/head.html
title= title
body
include includes/header.html
include #{pageContent}
include includes/footer.html
Any idea what I am missing ? Thank in advance for your help !
from Recent Questions - Stack Overflow https://ift.tt/vduCJG7
https://ift.tt/XonDdbU
Comments
Post a Comment