Skip to content
Discussion options

You must be logged in to vote

You could try passing in a _data/sources filename from your template:

---
# src/possums.njk
layout: list-post
source: possums
title: Possums
---

<h1>{{ title }}</h1>
---
# src/_includes/layouts/list-post.njk
layout: post
---

{{ content | safe }}

{%- set listdata = sources[source] -%}
{%- include "partials/list.njk" -%}

OUTPUT

<main>
  <h1>Possums</h1>
  <ul>
    <li>the possum named Fluffy is 2 years old</li>
    <li>the possum named Snugglepants is 5 years old</li>
  </ul>
</main>

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ptkw
Comment options

Answer selected by ptkw
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