Closed mlanza closed 1 year ago
Blocks cannot be used with the Lume layouts because it's not possible to pass the blocks defined by one template to other template. For example:
---
layout: main.njk
---
{% block credits %}
* <label>Designers</label>: Michael Kiesling & Wolfgang Kramer
* <label>Illustrators</label>: Paul Mafayon & Christophe Swal
{% endblock %}
Lume cannot get the credits
block and pass to main.njk
(at least I wasn't able to find a way to do that).
But you can use the nunjucks native layouts, that does that:
{% extends "main.njk" %}
{% block credits %}
* <label>Designers</label>: Michael Kiesling & Wolfgang Kramer
* <label>Illustrators</label>: Paul Mafayon & Christophe Swal
{% endblock %}
Thank you.
Enter your suggestions in details:
Nunjucks has a feature called blocks. It's useful when you have different sections of a certain page type. Without blocks you can inline your markdown in the yaml.
Inlining in the yaml is fine with small bits of content but is awkward when you have several sections each with substantial content. Blocks are better for this.
The blocks feature exists in Nunjucks but it didn't seem to work for me, so I wasn't sure if Lume as a wrapper implements it. I didn't see any examples taking advantage of blocks, even in the other templating languages.
I saw it rejected in #314 but I wasn't sure if it was the feature as a whole or a user-specific issue, since it seems relatively important when it comes to structured content writing. Maybe one of the other templating languages supports the concept? With the current design, I have pages with 3-4 sections in which I have to jam much of the prose into the front matter. I was looking at it and it didn't seem right my content should live up in the yaml.