Skip to content

Instantly share code, notes, and snippets.

@jonathanmoore
Forked from willbroderick/seo-hacks.liquid
Last active July 19, 2019 06:51
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 jonathanmoore/217fd7c0d62b6833f159ad31f8c312da to your computer and use it in GitHub Desktop.
Save jonathanmoore/217fd7c0d62b6833f159ad31f8c312da to your computer and use it in GitHub Desktop.
Shopify SEO - attempt to avoid duplicate meta descriptions
Change to make in theme.liquid
It adds a canonical tag for tag-filtered pages, back to the base collection/blog page.
*** Find this is the standard canonical tag code: ***
<link rel="canonical" href="{{ canonical_url }}" />
*** Completely replace it with this: ***
{% 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 %}<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