Home Forums Support H1 Post

  • This topic has 15 replies, 3 voices, and was last updated 4 years ago by Leo.
Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #917882
    Giuseppe

    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

    #917980
    Leo
    Staff
    Customer Support

    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.

    #918584
    Giuseppe

    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

    #918722
    Leo
    Staff
    Customer Support

    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.

    #919097
    Giuseppe

    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

    #919279
    David
    Staff
    Customer Support

    Hi there,

    the line hightlighted here needs to be updated:

    https://github.com/tomusborne/generatepress/blob/6067ee66bf7baf8a3fac45729c371e7cc5da404a/content.php#L34

    You can see the <h2> and </h2> tags that need to be changed.

    #923089
    Giuseppe

    Hi David,

    could you explain to me how do I access the content.php file and how can I change it?

    Thanks

    #923090
    Leo
    Staff
    Customer Support

    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.

    #923254
    Giuseppe

    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.

    #923421
    Leo
    Staff
    Customer Support

    Can you link us to the page in question?

    #923436
    Giuseppe

    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

    #923439
    Leo
    Staff
    Customer Support

    Is the child theme actually activated under Appearance > Themes?

    #923441
    Giuseppe

    Yes Leo,

    the child theme actually is activated under Appearance > Themes.
    I downloaded a completely blank starter child theme from here

    https://docs.generatepress.com/article/using-child-theme/

    #923493
    Leo
    Staff
    Customer Support

    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.

    #923538
    Giuseppe

    Hi Leo,

    I tried the procedure again, now it works!

    Perfect!

    Thanks a lot

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