Skip to content
Discussion options

You must be logged in to vote

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>

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@pdehaan
Comment options

pdehaan Dec 8, 2022
Collaborator

@smaimon
Comment options

Answer selected by smaimon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants