Overriding a block within an include
See original GitHub issuebase.html
{% include 'partial.html' %}
partial.html
{% block contents %}
partial.html
{% endblock %}
extension.html
{% extends 'base.html' %}
{% block contents %}
extension.html
{% endblock %}
Nunjucks 1.3.4 actual:
partial.html
Expected (?):
extension.html
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Overriding blocks within included Twig templates
I found a solution. Use the block() function to get the child's block content and pass it to header.html.twig as a variable in...
Read more >Conditional to override a block - Craft CMS Stack Exchange
I have a situation on a category page where I am wanting to override a block in the document this one is extending,...
Read more >How to override templates - Django documentation
Overriding from the project's templates directory¶ ... First, we'll explore overriding templates by creating replacement templates in your project's templates ...
Read more >Overriding blocks in mod-circulation - FOLIO Wiki
Override functionality allows the user to perform an action that should be otherwise blocked. Currently, there's only one type of check-out override -...
Read more >Base Templates and Blocks - Hugo
The block keyword allows you to define the outer shell of your pages' one or more master template(s) and then fill in or...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This reminds me of React’s
children
or Vue’s slot mechanism, which in turn would suggest a syntax like:which avoids the name collision issue by scoping blocks within the context of the included template. (I don’t know how parser internals work here, though, so no idea how feasible this would be - and at some point, you might just be better off using SSR support in React / Vue to perform static site generation, heh.)
It doesn’t relate to #539, IMO.