I want to create static html pages and bind the content to a javascript object, I know there is a plugin called MetalSmith-layout which binds the value from markdown file to the html, but for my case, the binding values are dynamic, so I cannot prepare a static markdown, or I have to create the markdown file on the fire.
So for my question, is there any better way to bind the template and javascript object just like Express router does? such as
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('homepage', vm);
});
homepage.swig
<html>
...
<div>{{ firstName }}</div>
<div>{{ lastName }}</div>
...
</html>
vm.json
{
"firstName":"Tom",
"lastName":"Hansk"
}