Hello,
given a collection “sections” residing in _sections and a page with multiple paragraphs, I’d like to create a section element for each paragraph. This I’d then include in my page but have the HTML for the section generated by some filter which abides by the layout specified in my section document, e.g instead of typing
{% for item in site.sections %}
<h2>{{ item.title }}</h2>
<p>{{ item.description }}</p>
<p><a href="{{ item.url }}">{{ item.title }}</a></p>
{% endfor %}
I’d prefer to have the layout defined in the section’s front matter define how the section is rendered in the page
project/_layouts/page.html:
<html>
...
{% for item in site.sections %}
{{ item | render }}
{% endfor %}
...
</html>
project/_layout/section.html
<h2>{{ item.title }}</h2>
<p>{{ item.description }}</p>
<p><a href="{{ item.url }}">{{ item.title }}</a></p>
project/_section/example.md:
---
title: Example section
description: An example
---
Hello World!
Does a filter like that exist? Is it possible to create this feature via plugins?
Kind regards and thanks in advance