A user needed to hide internal pages (containing size guides and text snippets) from their Shopify storefront search while keeping them accessible for product templates. Initial attempts using the seo.hidden metafield failed to affect storefront search results.
Working Solution:
Create a custom metafield for pages (e.g., hide_from_storefront_search) with integer values 0-1
Modify main-search.liquid by wrapping the search results list item (<li class="grid__item">) with an {% unless item.metafields.custom.hide_from_storefront_search == 1 %} condition
Set the metafield to “1” for pages to hide
Key Implementation Detail:
The {% unless %} tag must wrap the entire <li> element (not just the loop start) to prevent empty grid spaces where hidden results would appear.
Known Bug:
The search results counter still includes hidden pages in the total count, showing “5 results” when only 4 are visible. This cosmetic issue hasn’t been resolved.
Status:
Solution confirmed working on Dawn 6.0.2 and Studio theme (version 10.0.0), though one user reported it stopped working after updating Studio to version 11.0.0.
Summarized with AI on October 28.
AI used: claude-sonnet-4-5-20250929.
I’m using pages in my Dawn 6.0.2 theme to store snippets of text, size guides etc. to which I then refer from multiple product templates, so I don’t need to fill this content for each template separately.
These pages, however, are not to be seen by my shoppers, so I’m trying to find some way how to hide them from storefront search (and ideally from crawlers as well).
I have found multiple tutorials how to do this but I don’t seem to be able to replicate them.
If you are referring to search results in google or bing,etc that takes time for the pages to be removed as those companies crawlers update their private site indexes.
Or via their webmaster tools to request a recrawl.
The stores internal search can still serve stale content for a little bit, or your browser can also be showing you locally cached content.
Beyond that you’d want to look in the forums for topics on hiding content, hiding products, hiding pages, etc for the different ways that can be used to skip|hide content in store internal search results.
Basically find the search results item loop and do a check on the current items handle, or a metafield, and use a {% continue %} tag to skip it in the loop.
Roughly:
{% if item.metafields.seo.hidden == 1 %}{% continue %}{% endif -%}
I’m not a programmer though, so even (I think) I have found the loop, I’m not sure where to paste your code exactly.
I tried several places, also with and without {%- else -%}, but every time I either get no change at all or no search results at all - not even products without any value in this metafield.
Can you please advise, where exactly I should paste your code?
Below is part of the code in main-search.liquid - the loop - and by red is marked the code I added.
With code like this I don’t get any change in storefront search - all results are displayed regardless the value in the seo.hidden metafield.
@Cedcommerce this was almost it, thanks a lot, you saved me lot of time
I only made two changes:
When I placed the {% unless %} section as you proposed, it did hide the page I wanted but it “broke” the search results product grid - at places, where the hidden result was supposed to be was empty space, instead of for the other results to fill the empty slot. So I have just moved the code a little (see below).
Instead of using page handle I used custom metafield, so I don’t need to always edit the code when I want to hide some new page and just change the metafield value.
So if anyone reading this need the same thing, just follow steps below:
Step 1: Go to Admin → Settings → Metafields → Pages → Add definition and create metafield named “hide_from_storefront_search” (or any other name you like) and set content type to Number → Integer, minimum value to “0” and maximum value to “1”.
Step 2: Add to your code within the file “main-search-liquid” the red parts below. If you have different theme than Dawn 6.0.2, you might need to be little creative and figure out the differences in code.
Hey @VrVa thanks for your adjustment and notes…and thanks @Cedcommerce for the original on this, worked for me as well with the Studio theme. I tried a similar question recently and got nowhere. cheers-
Although I recently noticed one tiny BUG within this solution - even though the pages are hidden in the storefront search, the item counters on that page are counting the hidden results as well.
So for example if you have 4 products and one page with “hoodie” in the name and the page is set to be hidden, after searching the term “hoodie” the item counter will display 5 results even though you can only see 4 of them. So just that you now.
Interesting find…I have to say I doubt I would have ever found that. Good to know just the same, but that’s not going to matter in my situation. Thanks-
I have this same issue. I like that this solution hides my pages from storefront search, but it will still write “3 results” despite showing 0 results. Does anybody know how to modify the code to reflect the new amount of results?