How to remove specific pages from storefront search results

Topic summary

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 glad it helped @rorydean :slightly_smiling_face:

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.