Reputation: 77
I have got an html page and a bunch of markdown files. I want the content of the files rendered in my page. Generally, one would have the layout specified in the front matter of his markdown file and let that markdown file become an independent page. But, I don't want that. I have a single html page. I want to iterate through all the markdown files and display their content on the html page. Is there a way to do this? I tried-
{%for file in site.files%}
{{file.content}}
<br>
<hr>
{%endfror%}
But, I think I can't use file.content
to access the content of a markdown file.
Upvotes: 0
Views: 304
Reputation: 969
Make your markdown files a collection. Then you can loop the collection and access the file content.
{% for file in site.collection_name %}
{{ file.content }}
<br>
<hr>
{% endfor %}
Upvotes: 1