Your sites Log in Sign up Menu

Embed a markdown file inside my template?

I'm currently quite happy with the structure of my entries.html. Except for one thing. I would like the "intro" of that page to be easily editable. Right now, it's hard-coded in html, and I was wondering if I could insert a markdown file instead.

I've tried to add {{> intro.md}} in the entries.html file. But it does not render the markdown, it treats is as a plain text.


a year ago, 4 replies   templates   embed   Improve this question

If you add a file called 'intro.md' to the top-level directory of your blog folder, then you can embed its markdown contents in your like so:

{{> /intro.md}}

Please note the slash before the file name in the example above. If you placed 'intro.md' inside a subfolder called 'Pages' then you'd need to do this:

{{> /Pages/intro.md}}

Note that you can prevent the file 'intro.md' from appearing in your list of posts, or on your site's menu using the following metadata:

Page: yes
Menu: no

Does that help? Please let me know if you have any questions about this or anything else

Answered a year ago · Improve this answer

Arrgh, I was so close haha! Thanks a lot, it worked like a charm :)

Answered a year ago · Improve this answer

Hey, I now have the reverse question: is it possible to insert mustache inside an .md file?

Typical example: I have a page created with a markdown file. In this page, I want to insert a list of my few previous articles. I've tried this, but it doesn't render anything on the live website.

Have a look at a few articles I wrote:
<html>
{{#allEntries}}
    <p>
        <a href="{{{url}}}">{{title}}</a>
    </p>
{{/allEntries}}
<html>

Do you see a workaround? Thanks in advance :)

Answered a year ago · Improve this answer

It's not possible to use the template functionality inside a post or page right now. You can add a new view to your template, which lists recent posts

Answered a year ago · Improve this answer