Skip to content

Add FAQ entry for adjusting HTML attributes of headlines #1577

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

fritzmg
Copy link
Contributor

@fritzmg fritzmg commented Apr 26, 2025

Since this was already asked a few times in the community.

Copy link
Member

@zoglo zoglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, might be a bit confusing with the trailing and leading whitespace trimming but it's an example that could be copied.

I guess using parent() is due to modifications from other bundles since there is no content inside it in the original template?

@fritzmg
Copy link
Contributor Author

fritzmg commented Apr 26, 2025

might be a bit confusing with the trailing and leading whitespace trimming

Confusing in what way? Without it your (dev) output will be

<h2         class="foobar"
>

I guess using parent() is due to modifications from other bundles since there is no content inside it in the original template?

There is content inside the block: https://github.com/contao/contao/blob/f3c7f25292fe3ccd1680c6c27b5b87cf1c3ea240/core-bundle/contao/templates/twig/component/_headline.html.twig#L22

Without {{ parent() }} this example would not work.

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

Successfully merging this pull request may close these issues.

2 participants