[4.x]: Cannot use "tag" Twig tag inside "nav" Twig tag
Open
Nobody has claimed this yet.
bug
craft4
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
What happened?
This code will throw error (note the "tag" Twig tag placed inside "nav").
{% set entries = craft.entries().section('pages').all() %}
<ul id="nav">
{% nav entry in entries %}
{% tag 'div' with {
class: 'something',
} %}
some content
{% endtag %}
<li>
<a href="{{ entry.url }}">{{ entry.title }}</a>
{% ifchildren %}
<ul>
{% children %}
</ul>
{% endifchildren %}
</li>
{% endnav %}
</ul>
Craft CMS version
4.4.13
PHP version
8.1
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported template in Craft CMS 4.4.13, focusing on the interaction between the nested nav and tag Twig tags. Locate the relevant template-processing entry point and determine what regression coverage exists; done means the nested tags render without the reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100