Skip to content

How to hide the header 1 title of a specific page? #6185

Answered by shenweiyan
shenweiyan asked this question in Q&A
Discussion options

You must be logged in to vote

Let me share a solution I used to hide the first-level header on the home page.

  1. Referring to material/overrides/home.html, create a template called overrides/home.html with the following content:
{#-
  This file was automatically generated - do not edit
-#}
{% extends "base.html" %}
{% block htmltitle %}
    {% if page.meta and page.meta.title %}
        <title>{{ page.meta.title }}</title>
    {% elif page.title and not page.is_homepage %}
        <title>{{ page.title | striptags }}</title>
    {% else %}
        <title>{{ config.site_name }}</title>
    {% endif %}
{% endblock %}

{% block content %}
    {% include "partials/mycontent.html" %}
{% endblock %}

{% block extrahead %}
   …

Replies: 3 comments 1 reply

Comment options

alexvoss
Oct 13, 2023
Collaborator Sponsor

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@alexvoss
Comment options

alexvoss May 14, 2024
Collaborator Sponsor

Comment options

You must be logged in to vote
0 replies
Answer selected by shenweiyan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants