In drupal 8 how can I hide title on front page ? The title is rendered through page-title.html.twig through the code below

{% if title %}
  <h1{{ title_attributes.addClass('page-header') }}>{{ title }}</h1>
{% endif %}

I want to wrap it in if not front page condition but don't know the syntax.

  • Try with {% if is_front %} – MrD Jan 31 '18 at 9:54

For this you can use the is_front variable

{% if not is_front %}your code{% endif %}

The title is displayed in a block. Go to the block layout (/admin/structure/block), look for the block "Page Title", click on "Configure" and set the visibility on "Pages" to hide for <front>:

enter image description here

  • 2
    Wow, I didn't noticed that. Thanks for the answer, I must be using this option. – Fahad Ur Rehman Jan 31 '18 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.