Skip to content

Instantly share code, notes, and snippets.

@gbrits
Created November 3, 2021 12:08
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 gbrits/8d962c0db7123ab7821d383c12d69dca to your computer and use it in GitHub Desktop.
Save gbrits/8d962c0db7123ab7821d383c12d69dca to your computer and use it in GitHub Desktop.
Shopify Trailing Slash (SEO Optimisation)
{% if template contains 'collection' and current_tags %}
<meta name="robots" content="noindex" />
<link rel="canonical" href="{{ shop.url }}{{ collection.url }}" />
{% elsif template contains 'blog' and current_tags %}
<meta name="robots" content="noindex" />
<link rel="canonical" href="{{ shop.url }}{{ blog.url }}" />
{% else %}
{%- if canonical_url != blank -%}
<link rel="canonical" href="{{ canonical_url }}" />
{% endif %}
{%- endif -%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment