Site logo

Archived topic

No when switching off Content Title element

5 replies · Started by Reinoud on December 1, 2022

Viewing posts 1–6 of 6

Hi,

I am using a common page as the front page of my Generatepress website. Because I don't want the title in the top (it does not look good and/or is too long) I have 'switched off' the Content Title element on the index page only. I hope I translated this correctly. This works fine, the page is shown as I like it, but... there is no <H1> heading on my index page now, because of this switch off.

Is there a way to hide my Title to the visitors but still show the <H1> I want to Google bots? (and in a way that Google approves of)

Hi there,

there are a few options - for example:

Option A - manually add a H1 to the Page content.
Switch off the Content Title in the editor,
Add a GB Headline Block to your post content to display a different, shorter H1 title.
You can use the GB Headline blocks settings to style the H1 differently if you wish.

Option B - Make the Site Title ( in the header a H1 )
Add this PHP Snippet to your site:


add_filter( 'generate_site_title_output', function( $output ) {
    return sprintf(
        '<%1$s class="main-title" itemprop="headline">
            <a href="%2$s" rel="home">
                %3$s
            </a>
        </%1$s>',
        ( is_front_page() ) ? 'h1' : 'p',
        esc_url( apply_filters( 'generate_site_title_href', home_url( '/' ) ) ),
        get_bloginfo( 'name' )
    );
});

Then it will make the Site Title a H1 on the home page.
How to add PHP: https://docs.generatepress.com/article/adding-php/

Hi David,

Thank you,

Option B seems the easiest but is not working on sites where I have hidden the Website Title as well in order to show a website logo in the header instead of the title.

Option A: I don't seem to understand. I found the GB Headline Block. But it will be visible right?

The best option would be if I were somehow able to make the SEO Title of the page I put in the Yoast SEO box also the H1 title. But I guess there is not a snippet code of that?

A Search engine will get the Title from the sites title tag.
WP and GP output the title tag by default in the <head> of the site, and its content will be updated by Yoast.
Here is the title tag on the URL you shared:

<title>HAdesign.nl: Design Meubels en Woonaccessoires</title>

That is the title the search engine will use, in the absence of any other schema ( such as JSON-LD ).

Regarding H1: Google have stated your ranking won't be penalized for having no H1.

OPTION B - we could wrap the logo in a H1 .... but its kinda just ticking the "Page has A H1" box.

Option A: I don’t seem to understand. I found the GB Headline Block. But it will be visible right?

Yes it would be visible, but what is the point of hiding it ?

Hi David, thanks again. SEO was my main concern, thank you for the link. My new SEO Tool was upset with me that I don't have a H1 (only on the index) but I will just ignore that :) Thanks!

You're welcome.

This archived topic is closed to new replies.