[3.x]: {{ endBody() }} Tag is not replacing templates end of body for {% js %}
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
What happened?
Description
When the {{ endBody() }} tag is added within an include block, any {% js %} tag I use gets fired twice. Once at the {% endBody() %} and once right before the </body>. I've solved the problem by just removing the {% endBody() %} tag, but it's not expected behavior.
Steps to reproduce
- Create basic html block template, use at least one
{% include %}statement. - Place
{% endBody() %}tag within the{% include %}template file - Use
{% js %}within any template, view rendered page source to see the duplicate
Expected behavior
Rendered template javascript should appear on the page where {% endBody() %} is used, and not at the end of the document before </body>.
Actual behavior
Rendered template javascript is appearing both where {% endBody() %} is used, as well as at the end of the document before </body>
Craft CMS version
3.7.46
PHP version
8.0
Operating system and version
Linux 5.10.104-linuxkit
Database type and version
MySQL 5.7.38
Image driver and version
Imagick 3.7.0 (ImageMagick 7.1.0-35)
Installed plugins and versions
Embedded Assets 2.11.3
Feed Me 4.5.3
Imager v2.4.0
Redactor 2.10.9
SEO 3.7.4
Super Table 2.7.2
Typed link field 1.0.25
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
Reproduce the issue on Craft CMS 3.7.46 using an HTML block template with an include, placing {% endBody() %} in the included template and {% js %} in a template. Inspect the rendered page source to trace the include, endBody() and js entry points. Done means the JavaScript appears once at the endBody() location and not again before </body>.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100