Im using the Dawn theme and i really want to exclude blog posts and pages from the on site search, so they do not clutter the search results. I just cannot figure out what code to use and where to put it in the search liquid.
Can anyone help me?
Goal: In Shopify’s Dawn theme, exclude pages and blog posts from on‑site search results; requester wasn’t sure what code to change or where in search liquid.
Proposed fix: In main-search.liquid, comment out the block handling pages (the when ‘page’ section; noted around lines 231–242 for one user). To remove blog posts, also place a Liquid comment tag {% comment %} above the article section located just above that block in the default Dawn theme.
Outcome/status: The requester ultimately hired Shopify experts to implement the change. No in-thread confirmation that the suggested code edit was used or details on any side effects. Discussion appears concluded without further technical follow-up.
Im using the Dawn theme and i really want to exclude blog posts and pages from the on site search, so they do not clutter the search results. I just cannot figure out what code to use and where to put it in the search liquid.
Can anyone help me?
Hey @MetteT ,
I had the same problem and the solution that worked for me was commenting out the when ‘page’ part in the main-search.liquid file. The page information was on line 231-242 for me, and I can see in the default Dawn theme that the article bits are just above it too - so putting your {% comment %} above it should also exclude blog posts from your search results.
I ended up hiring shopify experts to do this for me.