-
|
Hi, Is there a way to call data from a "document1.md" stored in a collection folder named "sections" and populate an "index.njk" with the data? 🙏 Here is the src composition : And a src/sections/document1.md format and here the index.njk and want to display : |
Beta Was this translation helpful? Give feedback.
Answered by
pdehaan
Dec 8, 2022
Replies: 1 comment 2 replies
-
|
Something like this? ---
# src/index.njk
title: InDeX
---
<h1>{{ title }}</h1>
{% for p in collections.sections %}
<section>
<h2>{{ p.data.title }}</h2>
{{ p.templateContent | safe }}
</section>
{% endfor %}OUTPUT<h1>InDeX</h1>
<section>
<h2>My Title Document 1</h2>
<p>Content Document 1</p>
<p><img src="/img.png" alt="hi"></p>
</section>
<section>
<h2>My Title Document 2</h2>
<p>Content Document 2</p>
</section>
<section>
<h2>My Title Document 3</h2>
<p>Content Document 3</p>
</section> |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
smaimon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Something like this?
OUTPUT