Archived topic
H1 Post
15 replies · Started by Giuseppe on June 2, 2019
When I create an post and write its own H1, if I go to the blog's home page, the H1 written is turned into H2 on the blog's homepage. Why?
Even the titles of the posts, present in the category page, are transformed into H2.
Is it possible to transform the H2 of the post, present on the blog home page and in category page in H3?
In this way, I avoid the counting of H2 duplicates by the crawlers.
Thanks
Hi there,
It is do-able but I don't believe it is a good idea to change from entry titles from h2 to h3.
David explained here: https://generatepress.com/forums/topic/changing-the-h2-header-to-h3-and-the-distance-between-the-featured-image/
Let me know what you think.
Hi Leo
I read David's motivations for not changing the H2 in H3.
But there is a seo problem, the duplication of H2.
In this way, in fact, an H2 is created on the blog home page and another identical H2 is created on the category page to which the article belongs.
For this I would like to change the H2 to H3 or keep H2 on the blog home page while on the article category page, turn H2 into H3.
Thanks
That case you would have to overwrite the content.php file:
https://github.com/tomusborne/generatepress/blob/master/content.php
You can copy that file into your child theme folder and make the changes there.
Hi Leo
the linked file already contains the change to transform the H2 into H3 or what do I have to change inside the file to get this result?
Thanks
Hi there,
the line hightlighted here needs to be updated:
You can see the <h2> and </h2> tags that need to be changed.
Hi David,
could you explain to me how do I access the content.php file and how can I change it?
Thanks
The content.php file would be directly in the theme's folder (wp-content > themes > generatepress).
You can download a theme's file here, or directly from the link.
You would need to copy the file, paste it into your child theme, then make the change to line 34 of the file as David suggested.
Hi Leo
I changed line 34 of the file as David explained in this way :
the_title( sprintf( '<h3 class="entry-title" itemprop="headline"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h3>' );
I saved the file and uploaded it to the childtheme folder (by FTP), but does't works, because the titles of posts on the blog home page and in the category pages continue to be H2.
Can you link us to the page in question?
Hi Leo
in private there is link of blog home page where the post titles are still in H2 despite the change.
Also in the category page they continue to be in H2
Thanks
Is the child theme actually activated under Appearance > Themes?
Yes Leo,
the child theme actually is activated under Appearance > Themes.
I downloaded a completely blank starter child theme from here
Hmm any caching issue?
I just tried the exactly same thing and it worked without any issues:
https://www.screencast.com/t/XLxsbH5k
Make sure the content.php file is directly under the generatepress_child folder.
You should also see style.css and function.php at the same level.
Hi Leo,
I tried the procedure again, now it works!
Perfect!
Thanks a lot