Include _head.twig from post as well as base - #2676
Conversation
|
I have to admit I have to idea what this Instead of including the header in the post-page, would it be an idea to create a colours-CSS that we can include in both the main-CSS and the post-CSS? |
|
@monkeyiq What is your expertise on this? |
It doesn't include the visible header bar, nor do I think that would be sensible (for the same reason that concerns you). The visible theme header bar comes from The In |
|
As mentioned the It makes sense that _head is for the |
|
While it was still relatively fresh in my mind I added some docs for this in #2680 |
The
_head.twigfile introduced in 2.0 by commit 28cf796 provides a really convenient and straightforward way to introduce new elements into the without altering the templates or overriding them in a theme.Coupled with the proposed change to the CSS in simplesamlphp/simplesamlphp-assets-base#108, this also allows for a poor-man's theming option where colours can be overridden by simply adding some styling in
_head.twig.Unfortunately, while it is included by
base.twig, it is not currently included bypost.twig. That means it's not possible to apply this to the loader throbber introduced by 2.5 by #2516. While that might seem like a small issue, depending on the colour change, the current loader's default red can seem quite stark.This change means
_head.twigapplies to both base HTML templates.It introduces an additional context variable
includedFromso that people making changes in_head.twigcan determine where it is being used. A grep of the source suggests I'm not changing or overloading an existing twig variable by doing this, so it's a more-or-less backwards compatible change. The only risk is that someone has an existing_head.twigthat introduces extraneous elements intopost.twig(but they can fix that by adding a context check againstincludedFrom).