Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #226633

    I just noticed all the h1 headings for products <h1 class=”main-title entry-title”> are displaying as ‘Shop’ instead of the product name as the h1 heading in header then below in the product content the product name is another h1 heading

    Having 2 h1 headings may not be best for SEO however having keyword ‘Shop’ as the first h1 definitely won’t help that product’s SEO.

    How can I change ‘Shop’ to display the product name instead?

    Thank you for your help!

    #227158

    Hi!

    When editing the Product set this option at the right:

    Best regards,
    Josue

    #227177

    I thought of that option though that gets rid of breadcrumb navigation in addition to not maintaining consistency though-out the site.

    Displaying the product name as the h1 in place of ‘Shop’ would be the best solution. Then the second h1 in the product could be optionally hidden with css or removed from product template.

    How to replace ‘Shop’ H1 with the current product?

    Thank you for help!

    #227223

    Hi,

    Try adding this at the end of js/avia.js:

    jQuery(function() {
    	jQuery(".single-product h1.entry-title").text(jQuery(".single-product .product_title").detach().text());
    });

    Regards,
    Josue

    #227303

    Thanks Josue I tried implementing that but it causes some strange behavior…. first loading the ‘Shop’ and product headings and then removing noticeably on each page load.

    Maybe the best solution would be leaving the ‘Shop’ heading there but changing it from H1 to an H2 for product pages?

    In this way the H1 from the product will take priority over the ‘Shop’ H2 which will fix the page’s SEO

    Can this be done..changing the ‘Shop’ H1 to H2 heading on product pages?

    #227604

    Hi,

    Discard my previous message, try the following:

    Open /config-woocommerce/config.php and add this code in line 549:

    if(is_singular('product')) { $title = get_the_title(); }
    

    Regards,
    Josue

    #227657

    Great Josue that works changing the subheader H1 to the product title but the H1 permalink needs to be changed as well from the /shop link to the product’s link

    #227664

    Now add this line at the very end of functions.php:

    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
    

    You can also put it in /config-woocommerce/config.php if you prefer to have all the mods in one file.

    Regarding the /shop page, can you post a link to it? i didn’t get what you mean.

    Cheers!
    Josue

    #227683

    To clarify my previous post: the permalink on the H1 is still linking to the woocommerce ‘Shop’ page so needs to be changed to reflect the product’s url

    <h1 class="main-title entry-title">
    <a itemprop="headline" title="Permanent Link: Test Product" rel="bookmark" href="http://www.test.com/shop/">Test Product</a>
    </h1>

    See the link still points to the ‘Shop’ page not the the product’s link

    #227702

    I forgot the link, this would be the final line to add in /config-woocommerce/config.php, line 549:

    if(is_singular('product')){ $title = get_the_title(); $t_link = get_permalink(); 
    

    Regards,
    Josue

    #227716

    Mil Gracias Josue! I added the closing bracket } which was omitted from your posted code

    so this is the ‘revised’ final

    if(is_singular('product')){ $title = get_the_title(); $t_link = get_permalink(); }

    Thank you again!

    • This reply was modified 10 years, 10 months ago by ttem.
    #227741

    De nada :)

    Saludos,
    
Josue

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘2 h1 headings on product pages: 'Shop' in header and Product name’ is closed to new replies.