Archived topic
Multiple H1 tags on home page
13 replies · Started by Andrew on July 22, 2020
Hi
I seem to have multiple H1 tags on my homepage. The first one seems to be the correct one - It has taken my site title and put it as the H1 tag. The second H1 tag seems to be a duplicate of that and just below the first one but has put it in a "navigation-branding" div class for some reason.
On single post and pages, it's fine - There is only one H1 tag.
Please help. Thanks in advance. :)
Hi there,
I'm only seeing the site title as <h1> which is the default:
https://www.screencast.com/t/7YNxclrbBDj
Where are you seeing the second one?
Hi Leo
Thanks for the reply.
If you look at the source code for the home page (right click, "view source"), and then search for the following string "<h1" (by doing ctrl-F), you will see that it appears twice. The first one is inside <div class="site-branding" and the second is inside a <div class =“navigation-branding”
Thanks.
The navigation-branding one should only show on mobile in the mobile header.
Ah ok, thanks for your help. It was giving me an error in ahrefs site audit but I guess it's nothing to worry about?
I'll mention it to our team and see if it can be improved.
Thanks for pointing it out :)
Ok thanks Leo. Can we leave this open until we get feedback from the rest of the team?
Hi there,
This is a tough one, as there is a desktop header and a mobile header. We *could* remove the H1 from the mobile header, but that means mobile devices won't have an H1 on the page.
Since the headers never appear at the same time, I think it's a non-issue. Even Google says that multiple H1 elements per page isn't an issue:
https://www.youtube.com/watch?v=zyqJJXWk0gk
https://webmasters.stackexchange.com/questions/65452/is-it-acceptable-to-repeat-the-same-h1-tag-for-desktop-and-mobile-browsers-in-a
Hi Tom
Thanks for the reply. I think we can close this. :)
Cheers.
No problem! :)
I faced some issue and I think it's easy to fix by using this method
(wp_is_mobile()) ? $showH1 : $hideH1 ;
But how to use it with generate_site_title_output ?
Any chance you can link me to the page in question so I can see your current setup?
Feel free to open a new topic so you can use the private URL field.
Let me know :)
Thanks Leo,
I did and the new question is here
https://generatepress.com/forums/topic/how-to-fix-multiple-h1-tags-on-my-homepage/
Thanks!
We will take a look.