Skip to content

Instantly share code, notes, and snippets.

@isramv
Created February 10, 2023 15:05
Show Gist options
  • Save isramv/8dc3f98c179da5c946a209320c49059e to your computer and use it in GitHub Desktop.
Save isramv/8dc3f98c179da5c946a209320c49059e to your computer and use it in GitHub Desktop.
Remove the word "Front |" from the homepage Drupal 9
function custom_theme_preprocess_html(&$vars) {
$vars['is_front'] = \Drupal::service('path.matcher')->isFrontPage();
}
<html{{ html_attributes }}>
<head>
<head-placeholder token="{{ placeholder_token|raw }}">
{% if is_front %}
<title>Something custom</title>
{% else %}
<title>{{ head_title|safe_join(' | ') }}</title>
{% endif %}
<css-placeholder token="{{ placeholder_token|raw }}">
</head>
<body{{ attributes.addClass(body_classes) }}>
...
...
...
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment