I'm trying to use the page title in my theme's page.html.twig
. On normal pages, {{ node.label }}
does the job, but that doesn't work on the front page. There, node
is NULL
, presumably because the font page is a view rather than a "real" page.
I have tried to dump all the available variables on page.html.twig
using kint
, but it seems that none of them contains the page title. Other questions discuss a similar matter, but either only for normal pages or for getting the title from PHP (and not from within a TWIG template).
I'm looking for an approach that works in any template, although page.html.twig
is most important for me right now. It should also take a global title override into account. The ideal solution would also work on normal pages (i.e. not the front page).
TL;DR: I'm looking for a template variable/function X
so that {{ X }}
is the current page title, no matter whether I'm on the front page or on any other page.
front page title
??? what would that be? the website name?