I'm getting started with node.js and particularly express.js.
Given that I like to be as D.R.Y. as possible, I've decided to have only one index.pug-template which has single HTML element main.content in the body. The actual content is created by pug.renderFile(), based on excerpt, stored in <name>.pug file.
The whole picture is this:
SERVER.JS
response.render("index", {
content: pug.renderFile(excerpt("aboutus"), {
title: "About Us",
subtitle: "Some subtitle here",
article: "Some text here"
})
});
ABOUTUS.PUG
h1= title
h3= subtitle
article= article
INDEX.PUG
//- html-head-body routine
main.content= content
The problem is that pug.renderFile() returns HTML code in form of string and, instead of getting three elements inside main.content element, I'm getting this exact string as .innerHTML of this element.
So, what is my mistake here?