I have a list that is represented as separate files:
list/element1.md
list/element2.md
list/list.json
I would like to output them as collection.
I iterate over them in the separate .njk file (this is an example, the real layout is a little bit more complicated):
inlcudes/list.njk
<ol>
{% for element in collections.list %}
<li>
{{element.data.title}}
</li>
{% endfor %}
</ol>
Then I include this .njk file in my final .md page file.
pages/home.md
---
layout: page.njk
title: Home
templateEngineOverride: md,njk
---
# Home page
{% include 'list.njk' %}
The problem is that content inside for-loop is wrapped inside pre tag:
<h1>Home page</h1>
<ol>
<pre><code><li>
Element 2
</li>
<li>
Element 1
</li>
</code></pre>
</ol>
I tried different combinations of values in templateEngineOverride parameter but none worked.
Yes, I can use .njk instead .md as page file extension, but I need to be able to use markdown in it. Also I can't output list directly in .md file as I want to put this list in another pages with include.
Please help. Are there any solutions?
I have a list that is represented as separate files:
list/element1.md
list/element2.md
list/list.json
I would like to output them as collection.
I iterate over them in the separate .njk file (this is an example, the real layout is a little bit more complicated):
inlcudes/list.njk
Then I include this .njk file in my final .md page file.
pages/home.md
The problem is that content inside for-loop is wrapped inside pre tag:
I tried different combinations of values in templateEngineOverride parameter but none worked.
Yes, I can use .njk instead .md as page file extension, but I need to be able to use markdown in it. Also I can't output list directly in .md file as I want to put this list in another pages with include.
Please help. Are there any solutions?