Re: Hide a Collection Page from search engines

Hide a Collection Page from search engines

fieldscrubs
Visitor
2 0 0

I am trying to hide a Collection Page specifically. 

I've followed this help doc: https://help.shopify.com/en/manual/promoting-marketing/seo/hide-a-page-from-search-engines which works great for regular pages. But it does not work for the Collection pages I am trying to hide. 

The help doc has you put this code in the <head> section to hide a page: 

{% if handle contains 'page-handle-you-want-to-exclude' %}
<meta name="robots" content="noindex">
{% endif %}

If I sub 'collection.handle' for 'handle' will the collections in question be hidden? Any other workaround?

Thanks!

Replies 5 (5)

ecomartus
Visitor
2 0 0

Hey there!

I have actually found a solution on hiding best sellers from customers. This may help you, just need to adjust the code and also words in the collection.liquid file. There is how mines look.

See there:

{% if collection.sort_by == 'best-selling' %}
I see you! Stopy copying me you bustard.
{% else %}
{% include 'shogun-products', content: collection %}
{{collection.metafields.shogun.above}}
{% section 'collection-template' %}

{{collection.metafields.shogun.below}}


{% endif %}

Just modify this code to your liking and thank me later 😉

 

Hope this Helps,

Artus

fieldscrubs
Visitor
2 0 0

Thanks but I am looking to hide from Search Engines, not customers. 

Not applicable

Using collection.handle will pretty much do it but you should probably also check if the template is collection because the collection object can exist on other pages as well

{% if template == 'collection' and collection.handle == 'the-handle-to-hide' %}
    <meta name="robots" content="noindex">
{% endif %}

 

KravMaga
Visitor
1 0 1

I found this article https://yagisoftware.com/articles/how-to-hide-products-from-search-in-shopify-store.html and applied it to a collection.

The collection page source code now shows the meta name="robots" content="noindex,nofollow" on the collection page. 
I am hopeful that this will fix the issue. 

If a few years too late 🙄

GitHubby
Shopify Partner
4 0 2

Also useful for pages too.