Passing data to includes
See original GitHub issueTwig supports sending data to includes, like so:
{% include 'include.twig' with {
name: 'whatever'
} %}
This is really useful in many cases, like re-using a block in different contexts, with different behaviour / data. Have anyone looked into adding support for this?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:109
- Comments:38 (7 by maintainers)
Top Results From Across the Web
php - Laravel - How to pass data to include - Stack Overflow
I need to pass data to the header on every single view. Is there a way to pass data just to the include...
Read more >Passing Data with a Twig Include Statement - CraftQuest
The Twig include statement is a fantastic little tool because it allows us to chunk our template code into smaller, reusable pieces.
Read more >Passing post variables to includes in Jekyll - sverrirs.blog
In Jekyll includes do not have access to variables defined in your posts or pages. But don't worry here is how you can...
Read more >Passing data to includes - overrides & defaults
What you need to do in your include is to check, if the variable was passed in from the outside, and if not,...
Read more >Passing variables between pages using URL GET or POST ...
There are different ways by which values of variables can be passed between pages. One of the ways is to use the URL...
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
Not the best solution, but works for me.
Input:
_partials/section-header.html
Output:
As the new maintainer I’m slowly making my way through old tickets. This seems like something worth adding.