Skip to content

Instantly share code, notes, and snippets.

@davelowensohn
Created February 9, 2017 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davelowensohn/1ecdb7911ea35784495d021746f8f05c to your computer and use it in GitHub Desktop.
Save davelowensohn/1ecdb7911ea35784495d021746f8f05c to your computer and use it in GitHub Desktop.
Shopify canonical_url - override with product.collections.last
...
{% if template contains 'product' and product.collections.size > 0 %}
<link rel="canonical" href="{{ shop.url }}{{ product.collections.last.url }}/products/{{product.handle}}" />
{% else %}
<link rel="canonical" href="{{ canonical_url }}" />
{% endif %}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment