I am using the following code to change a view title to a custom title:
function MYMODULE_preprocess_page_title(&$variables) {
if (some logic to check if this is the correct view)
$variables['title] = 'Something Different!';
}
This works to change the title in the content area within the <h1>
tag, but the title of the browser tab is not changed (in <html><header><title>...</title>
).
What is the correct way to change the view title to reflect both in the page body and the browser title?
This page should be able to help.
tl;dr You can either set the title in the *.routing.yml
file (either statically or dynamically) or you can set the title by setting #title
in a markup array.