Liquid, JavaScript, themes, sales channels
Hi Guys
We recently acquired a new client and after running a crawl of the site we uncovered a number of URLs that are close duplicates of existing Collection Pages and are in Google's Index. See example below.
https://www.cherrymelon.co.za/collections/tops
https://www.cherrymelon.co.za/collections/types?q=tops
The second URL is the issue and I want to remove them permanently.
Now I have 2 questions:
- How were these pages created as I cannot find them anywhere in the back-end
- Is it possible to remove them completely?
Been struggling with this for a while.
Hello!
I guess the easiest way would probably to do something like this in the head of theme.liquid.
@HerokuLiee wrote:Hello!
I guess the easiest way would probably to do something like this in the head of theme.liquid.
{% if handle contains 'types' %}<meta name="robots" content="noindex">{% endif %}
Thanks for your response. Why only quoting 'types' and not the rest of the handle?
Also how did these URLs get created? Basically i have one of these extra for every Collection i have.
Probably just the way your theme filters collections.
https://shopify.dev/docs/themes/liquid/reference/objects/handle
I think handle will only return the handle part of the URL not the entire URL. If you needed to get the entire URL you'll probably have to do it in JS
Thanks for this advice.
I have added the suggested code, but seems like nothing has changed.
When i inspect the URL, there is still no tag on META tag on the page.
Would this app help at all: https://apps.shopify.com/sitemap-noindex-manager
There is a "native" way of adding no index for a product.
Please see: https://shopify.dev/tutorials/manage-seo-data-with-admin-api
You need to create a Metafield with the following values:
"namespace" : "seo"
"key" : "hidden"
"value" : 1
"value_type" : "integer"
The other solution - it works as confirmed if you have the filters in the URLs:
{% if template contains 'collection' and current_tags %}
<meta name="robots" content="noindex" />
<link rel="canonical" href="{{ shop.url }}{{ collection.url }}" />
{% else %}
<link rel="canonical" href="{{ canonical_url }}" />
{% endif %}
@Mircea_Piturca wrote:There is a "native" way of adding no index for a product.
Please see: https://shopify.dev/tutorials/manage-seo-data-with-admin-api
You need to create a Metafield with the following values:
"namespace" : "seo"
"key" : "hidden"
"value" : 1
"value_type" : "integer"
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024