Blot

Mustache partials inside Markdown pages?

I was hoping to leverage Mustache partials inside some Markdown files but either it's not working or I'm doing something slightly wrong.

Here's what I've tried:

A file pages/test.md which uses the {{> _test.html}} syntax for the file pages/_test.html which is located in the same directory. I don't get any rendering errors but it doesn't work either. I've tried a few variations e.g. {{> /pages/_test.html}}, {{> pages/_test.html}}, etc but those have not worked either.

Asked 10 months ago Edit
1 replies

This isn't possible, posts are treated differently to template files. I'm open to making this possible in future but it won't work for the moment.

I'm working on markdown embed support. I also just came across this markdown extension which could be useful

However, you can use custom metadata to get this working right now, for example, in your main post:

embed_test: yes

Your main post here.

Then you can create the post to be embedded, /Posts/To-Be-Embedded.md:

Page: yes
Menu: no

The content to be embedded

Note you must not use an underscore in the file name – this causes Blot to completely ignore the file.

And then in your template's entry.html file, which is responsible for rendering each post and page, you can conditionally embed it:

{{#entry}}
    ...
    {{#metadata.embed_test}}
    {{> /Posts/To-Be-Embedded.md}}
    {{/metadata.embed_test}}
    ...
{{/entry}}
10 months ago Edit

Your reply