cms
cms copied to clipboard
Bard Field with antlers parsing outputs additional Paragraph Tags
Bug description
If you use a globals with a Bard Field. And try to output it inside another Bard Field you get one additional paragraph tag before and after the globals output.
I would expect no additional tags before and after.
How to reproduce
https://github.com/Jubeki/statamic-bug-antlers-and-bard
- User:
[email protected] - PW:
password
Steps for setting up:
- Setup a fresh Statamic Application
- Add a Globals with a Bard Field and some content (Globals:
contact, Bard Field:details) - Use a Bard Field on the Page Collection, enable Antlers parsing and output the global
{{ contact:details }} - See on the homepage that before and after the global output are each one additional empty paragraph tag. (using the Dev Tools)
Changing the Remove Empty Nodes Option from Don't remove empty nodes to Remove empty nodes at start and end does not change the behaviour.
Logs
No response
Environment
Environment
Application Name: Statamic
Laravel Version: 11.23.5
PHP Version: 8.3.11
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED
URL: localhost:8000
Maintenance Mode: OFF
Timezone: UTC
Locale: en
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED
Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file
Statamic
Addons: 0
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.25.0 Solo
Installation
Fresh statamic/statamic site via CLI
Additional details
No response
Unfortunatley, I can't seem to reproduce this...
I cloned down your repository, enabled the "Antlers" setting on the details field and slimmed down the layout so the <body> is just {{ contact:details }}.
Hey @duncanmcclean thanks for looking into it.
I also stripped down the repository now and the issue still occurs.
Strip Down Commit: https://github.com/Jubeki/statamic-bug-antlers-and-bard/commit/13241052935bf07a635889954d1f574590d9d9df
I also have deploy the same repository, without any changes (except enabling production mode and disabling debug) to https://statamic.kiekbjul.de
Where I also can see the same issue (Safari and Chrome):
The problem lies within using {{ contact:details }} within another Bard Field (on the Homepage in this case) and not directly in a view.
The problem lies within using
{{ contact:details }}within another Bard Field (on the Homepage in this case) and not directly in a view.
Oh, I see it now. Thanks!
Out of curiosity, why are you using Antlers inside a Bard's content, instead of using a Bard set?
I must say, I didn't really think about using a set for this, because I only thought about outputting the globals value like with antlers, and that was the simplest thing I could think of in that moment.
One of the main reasons may be: That I use the contact details in different contexts:
- Footer Globals, which has 3 Columns, each with a Bard Field
- Pages Collection, which has a Bard-Field as a Page-Builder and in there is a Cards-Set, where each Card also has a Bard-Field. So in one such a card the value is also used.
- Inside a view directly
So they are different Bard Fields and I would need to configure them accordingly.
(I will take down statamic.kiekbjul.de to prevent miss use)