Archived topic
how to add a h1 tag to my homepage?
16 replies · Started by Sven on December 8, 2015
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!?
I would like to know that either.
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??
Thanks for the link, I will check the issue later and will write back if I have something useful to add.
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/
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.
Having an H1 on every page will help your rankings :)
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
Give this function a shot:
add_action( 'wp', function() {
if ( is_paged() ) {
remove_action( 'generate_archive_title', 'generate_archive_title' );
}
} );
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
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' );
}
} );
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
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.
Ok, thanks!! Now I have to invite you to my house and have lunch together
Btw just loving your theme Tom
No problem! Thank you! Great to hear :)