What's your biggest current challenge? Have your say in Community Polls along the right column.

Adding canonical tag only to the homepage?

Adding canonical tag only to the homepage?

chaweng2012
Visitor
1 0 0

Hello,

 

I was wondering if anyone can help. I need to change the homepage ONLY to refer to another page (a collections page) on my site, as the homepage is cannabalising the ranking and the collections page is the preferred page.


Is there any way of editing the html so just the canonical link on the homepage is updated (to direct to the product page?)


Many thanks!

Reply 1 (1)

Olllie
Shopify Partner
101 9 19

Hey @chaweng2012 ,

This should be the code you need! Simply add it near the top of your theme.liquid file:

 

 

 

{% if template == 'index' %}
  <link rel="canonical" href="https://www.AddYourUrlHere.com" />
{% endif %}

 

 

 

If this resolves your issue, please consider marking the answer as helpful or accepted!

Ollie | Founder & Developer of autoBlogger

autoBlogger: Seamlessly scheduled, fully automated, AI-powered, and SEO-optimised blogging with a host of free extras! Start your 14-day free trial today!



Discover more at autoBlogger.bot!