-
AuthorPosts
-
February 20, 2014 at 8:19 am #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!
February 21, 2014 at 1:10 am #227158Hi!
When editing the Product set this option at the right:
Best regards,
JosueFebruary 21, 2014 at 1:27 am #227177I 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!
February 21, 2014 at 4:10 am #227223Hi,
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,
JosueFebruary 21, 2014 at 8:03 am #227303Thanks 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?
February 21, 2014 at 6:43 pm #227604Hi,
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,
JosueFebruary 21, 2014 at 8:28 pm #227657Great 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
February 21, 2014 at 8:47 pm #227664Now 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!
JosueFebruary 21, 2014 at 9:17 pm #227683To 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
February 21, 2014 at 10:15 pm #227702I 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,
JosueFebruary 21, 2014 at 10:39 pm #227716Mil 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.
February 21, 2014 at 11:16 pm #227741De nada :)
Saludos,
Josue -
AuthorPosts
- The topic ‘2 h1 headings on product pages: 'Shop' in header and Product name’ is closed to new replies.