I have a Drupal 8 site with a content type called Landing Page. I'm using the bootstrap theme and I have the block showing the brand info (including site slogan) in the navbar.
I want some of the landing pages to have a different site slogan (shown in the navbar). How can I do that?
What I tried
I thought of adding a text field custom site slogan to my Landing Page content type and then using a twig template (content type node template) to show the slogan, but the slogan is printed in the header, and the template comes after that.
I could also make a different branding block for each page I need to change the slogan on and manually change the text in a twig template, but that seems like a very horrible, labor intensive way to do it.
preprocess_node()
to check if the field has value and replace the slogan from the site block. Or if the alternate slogan is the same for all changed pages, use aboolean
field on the content type? Off the top of my head, seems like you'll need some flag somewhere on the content type level...HOOK_preprocess_block
and in there check for node pages with$node = \Drupal::routeMatch()->getParameter('node');
\Drupal::routeMatch()->getParameter('node');
be translated in OOP to 50 out of 500 nodes?