April 12, 2017
Over the last few days I have been messing around with Blot’s template system. At the moment, the logic which routes requests to your blog is hard-coded into Blot’s source code.
For example, to create a page containing all your blog posts tagged ‘Apple’, you have to create a template called ‘tagged.html’ which handles requests to /tagged/:tag
. This is explicitly declared in tagged.js.
I intend to use to make this process dynamic. You’ll be able to create a template called, say category.html
and specify its route.
---
Route: /category/:tag
---
<html>
<body>
{{#tag}}
All posts in the category {{tag}}.
{{#entries}}
- {{title}}
{{/entries}}
{{/tag}}
</body>
</html>
...
I’ll be using the route-parser library to help route requests to the right template. I have also been testing Hogan and it has been faster than Mustache.