Why is my canonical URL not rendering as the HREF in Empire theme?

Why is my canonical URL not rendering as the HREF in Empire theme?

davidculbertson
Excursionist
22 0 7

Hi  Community,

 

I'm baffled. I've got a site using the Empire theme for which I am trying to make the URL always be the canonical. For example, I want https://www.purelyintegrative.com/collections/omega-3s/products/arctic-orange to always render as https://www.purelyintegrative.com/products/arctic-orange. I used this theme.liquid change successfully on at least one other site but it's not working this time:

 

replaced:

<link rel="canonical" href="{{ canonical_url }}" />

 

with

 

{% if template contains 'collection' %}
<link rel="canonical" href="{{ shop.url }}{{ collection.url }}" />
{% else %}
<link rel="canonical" href="{{ canonical_url }}" />
{% endif %}

 

I then searched the help community and found a suggestion a make this change to product.liquid:

 

Replace

 

"{{ product.url | within: collection }}"

with:

{{ product.url }}

 

That didn't work either. What I am doing wrong?

Replies 0 (0)