Black Friday Sale! Get up to $40 off GP Premium!Learn more

[Resolved] how to add a h1 tag to my homepage?

Home Forums Support how to add a h1 tag to my homepage?

  • This topic has 16 replies, 2 voices, and was last updated 2 months ago by David.
Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #158695
    Sven

    i’ve installed gp premium and i’m very very happy with your theme. now i analyzed my homepage with one of these seo tools and it seems i’ve no single h1 tag. some people say that’s really bad for a good google search experience. i’m not an expert but i think the title of my Homepage should be the h1 tag or i’m false!?

    #158699
    meleager

    I would like to know that either.

    #158759
    Sven

    I’ve found the solution right here in the forum…

    https://generatepress.com/forums/topic/h1-as-page-title/page/2/#post-145765

    The look and feel of my header area is exactly the same as before. The Difference is that the site title is now h1-tagged (only on the start page).

    i’m a little bit suprised that this isn’t the default behaviour??

    #158761
    meleager

    Thanks for the link, I will check the issue later and will write back if I have something useful to add.

    #158783
    Tom
    Lead Developer
    Lead Developer

    Hi Sven,

    Great find!

    I would make it default behavior, but it might cause a change in the way some people are using their headers on updates. I try to make it so the updates don’t change anything drastic.

    Also, not everyone uses a site title in their header – some use a logo or header.

    For people using a logo or header, they can do something like this:

    add_action( 'generate_before_main_content', 'generate_add_blog_title' );
    function generate_add_blog_title()
    {
    	if ( ! is_home() )
    		return;
    	?>
    	<header class="page-header">
    		<h1 class="entry-title" itemprop="headline">My Blog Title</h1>
    	</header>
    	<?php
    }

    Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/

    #648987
    Ranjit Kumar

    thanks for sharing this!! One question… will it help me in seo for better rankings if implemented H1 in homepage. or it has some negative impact.

    #649435
    Tom
    Lead Developer
    Lead Developer

    Having an H1 on every page will help your rankings πŸ™‚

    #651485
    Ranjit Kumar

    One last question tom I know this is off topic but plz help regarding this

    In my category pages I have included a short description but when I am going to the second page of the category it’s showing the same description at the top( means in every page of that category it’s showing the same description) now will have I have to set the canonical to the first page.

    example:
    https://www.allchickenrecipes.com/chicken-recipes/chicken-breast-recipes/ –
    see the description

    https://www.allchickenrecipes.com/chicken-recipes/chicken-breast-recipes/page/2/

    the same description on the top and so on with the next pages

    Plz help regarding this tom

    #651940
    Tom
    Lead Developer
    Lead Developer

    Give this function a shot:

    add_action( 'wp', function() {
        if ( is_paged() ) {
            remove_action( 'generate_archive_title', 'generate_archive_title' );
        }
    } );
    #652496
    Ranjit Kumar

    That worked! thanks tom

    But one last question! i have set the h1 title on my homepage as the function given above and it’s workinng absolutely fine no problem on that (see my website) but again the same question, when i move to the next page it’s showing that h1 tile again (every page of homepages)
    Question 1: Will it cause any duplicate conent with same heading on every page
    Question 2: Or, what if i use the infinite scroll, so that it will be in single page

    plz answer two questions in detail

    #652877
    Tom
    Lead Developer
    Lead Developer

    You can tweak your full function to this:

    add_action( 'generate_before_main_content', 'tu_add_blog_title' );
    function tu_add_blog_title() {
    	if ( ! is_home() )
    		return;
    	?>
    	<header class="page-header">
    		<h1 class="entry-title" itemprop="headline">My Blog Title</h1>
    	</header>
    	<?php
    }
    
    add_action( 'wp', function() {
        if ( is_paged() ) {
            remove_action( 'generate_archive_title', 'generate_archive_title' );
            remove_action( 'generate_before_main_content', 'tu_add_blog_title' );
        }
    } );
    #652903
    Ranjit Kumar

    Thanks tom! And what about if i use the infinite scroll option..then there will be no second page available. Will it help me in seo?

    Waiting for your reply

    #653135
    Tom
    Lead Developer
    Lead Developer

    Infinite scroll doesn’t have any effect on SEO, and the second page still technically exists for robots. The infinite scroll functionality is for humans only.

    #653237
    Ranjit Kumar

    Ok, thanks!! Now I have to invite you to my house and have lunch together

    Btw just loving your theme Tom

    #653577
    Tom
    Lead Developer
    Lead Developer

    No problem! Thank you! Great to hear πŸ™‚

Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.