You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is sometimes useful to be able to pass data back from the parent template when dealing with included and/or imported child templates.
My specific use case:
Parent:
{% set footnotes = ["that means that", "the other thing refers to that"] %}
{% set content = "this, that[^1] the other thing[^2]" %}
<section class="content">
{% include "content.njk" %}
</section>
<section class="footnotes">
{% foreach reference in references %}
<div>{{ footnotes[reference - 1] }}</div>
{% endfor %}
</section>
Child (content.njk):
{# I have some complex macro here to render the content which finds and formats references #}
{% set references = [1,2] %}
{{ content | markdown }}
Would be nice if there were a {% include "content.njk" allow-writing-to-context %} or some other way to allow a child template to pass data back through the context.
The text was updated successfully, but these errors were encountered:
It is sometimes useful to be able to pass data back from the parent template when dealing with included and/or imported child templates.
My specific use case:
Parent:
Child (
content.njk
):Would be nice if there were a
{% include "content.njk" allow-writing-to-context %}
or some other way to allow a child template to pass data back through the context.The text was updated successfully, but these errors were encountered: