Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bard Field with antlers parsing outputs additional Paragraph Tags #10825

Open
Jubeki opened this issue Sep 23, 2024 · 5 comments
Open

Bard Field with antlers parsing outputs additional Paragraph Tags #10825

Jubeki opened this issue Sep 23, 2024 · 5 comments
Labels

Comments

@Jubeki
Copy link
Contributor

Jubeki commented Sep 23, 2024

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: test@example.com
  • PW: password

Steps for setting up:

  1. Setup a fresh Statamic Application
  2. Add a Globals with a Bard Field and some content (Globals: contact, Bard Field: details)
  3. Use a Bard Field on the Page Collection, enable Antlers parsing and output the global {{ contact:details }}
  4. 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

@duncanmcclean
Copy link
Member

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 }}.

CleanShot 2024-09-24 at 10 53 56

@Jubeki
Copy link
Contributor Author

Jubeki commented Sep 24, 2024

Hey @duncanmcclean thanks for looking into it.

I also stripped down the repository now and the issue still occurs.

Strip Down Commit: Jubeki/statamic-bug-antlers-and-bard@1324105

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):

Screenshot 2024-09-24 at 12 09 29

@Jubeki
Copy link
Contributor Author

Jubeki commented Sep 24, 2024

The problem lies within using {{ contact:details }} within another Bard Field (on the Homepage in this case) and not directly in a view.

@duncanmcclean
Copy link
Member

duncanmcclean commented Sep 24, 2024

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?

@Jubeki
Copy link
Contributor Author

Jubeki commented Sep 24, 2024

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:

  1. Footer Globals, which has 3 Columns, each with a Bard Field
  2. 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.
  3. 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants