Titles and breadcrumbs
In the component library, we have an atom both for the title and for the breadcrumbs, so we can simply include them. There are just a couple of details to be aware of.
Title
The title
template receives a couple of variables that may not seem useful because, in Drupal core, they’re always empty: title_prefix
and title_suffix
. Those two variables can be filled by a custom or contributed module; if we forget to print them, this may lead to some unexpected behavior.
Our version for the page-title.html.twig
template should be like this:
{{ title_prefix }} {{ include('@atoms/title.html.twig', { 'title': title, }) }} {{ title_suffix }}
Put this code in a file with the same name, in the templates/content
folder of the alps_trips
theme.
Breadcrumb
Styling a breadcrumb is easy; the template receives only one variable, and our component in Storybook takes care of rendering it in the correct way. Just don’...