New Shopify Certification now available: Liquid Storefronts for Theme Developers

How to remove blogs & pages from my in-store searching result

Solved
KATZZ
Tourist
8 0 2

I have searched the similar question in the community. The answer is to edit the store theme code. I have tried to follow the instruction, but I have no experience in code editing.

 

I am using the theme 'Dawn'. Does anyone know where to edit the code? I am following the link on this page: https://shopify.dev/themes/navigation-search/search but still have no idea where to add the code.

pic.png

Accepted Solution (1)
GemPages
Shopify Partner
5587 1260 1166

This is an accepted solution.

Hello @KATZZ 

I would like to give you some recommendations to support you

You can follow these steps:

1. Go to Online Store->Theme->Edit code
2. Open your header.liquid theme file
Please search with keywords: 'search__button '

add the code just above the button

<input type="hidden" name="type" value="product" />

Screenshot at Nov 11 15-17-57.png

 

Screenshot at Nov 11 15-17-16.png

 

Hope my recommendation can works and support for you! Kind & Best regards! GemPages

GemPages - Build any high-converting store pages for any business


- If you find my reply helpful, please hit Like and Mark as Solution
- Get connected: App Store | Blog | Community | Help Center

View solution in original post

Replies 10 (10)
MandasaTech
Shopify Expert
723 146 150

Hello @KATZZ 
1) Open your admin panel.
2) Click on online store.
3) Then click on action button in the dropdown click on Edit code.

☞ Helpful or Question answered? Please Click Like & Mark it Accepted Solution
☞ Want to modify or custom changes on store for affordable price? Click on Contact button here
☞ Email at info@mandasa.in
☞ Whatsapp at +918989609120 | Hire us at: Website Support Page
GemPages
Shopify Partner
5587 1260 1166

This is an accepted solution.

Hello @KATZZ 

I would like to give you some recommendations to support you

You can follow these steps:

1. Go to Online Store->Theme->Edit code
2. Open your header.liquid theme file
Please search with keywords: 'search__button '

add the code just above the button

<input type="hidden" name="type" value="product" />

Screenshot at Nov 11 15-17-57.png

 

Screenshot at Nov 11 15-17-16.png

 

Hope my recommendation can works and support for you! Kind & Best regards! GemPages

GemPages - Build any high-converting store pages for any business


- If you find my reply helpful, please hit Like and Mark as Solution
- Get connected: App Store | Blog | Community | Help Center
KATZZ
Tourist
8 0 2

Thanks! It is very clear. I have successfully edited it.

flareAI
Shopify Partner
2405 223 533

Hello @KATZZ,


This is flareAI: your Fully Automated Free Sales Machine. I hope you're having a good day. flareAI is helping lots of successful Shopify stores generate $5+ million in sales from Google Search, on autopilot.


If my suggestions is helpful to you, please let me know by giving a like or marking it as a solution.


You can restrict the Shopify search to show only product pages.


To achieve a custom search, you can add a hidden field in the header.liquid file.


Go to your Online Store > Themes > Edit code > header.liquid file


Find 'routes.search_url' and add the hidden field inside the <form action={{routes.search_url}}> section.

 

<form action={{routes.search_url}} ....>
<div class="field">
<input type="hidden" name="type" value="product">
......
</form>


Similarly, go to main-search.liquid file, find 'routes.search_url' and add a hidden field there also:

<form action={{routes.search_url}} ....>
<div class="field">
<input type="hidden" name="type" value="product">
......
</form>


This will restrict giving only product pages in the storefront search result.


You can read this blog for more details.


Hope this helps,


Gina
flareAI

flareAI : Get Sales from Google Search, on Autopilot
$10+ billion in eCommerce on Google Search, every day. Find out how much you are missing
kcljnguyen
Shopify Partner
3 0 1

what should the value be if i want to include products and pages but exclude only blog articles?

kcljnguyen
Shopify Partner
3 0 1

i think i figured it out. to include product and pages (but not blog articles):

<form action={{routes.search_url}} ....>
<div class="field">
<input type="hidden" name="type" value="product,page">
......
</form>
zakfinch
Tourist
4 0 3

Question - what line did you replace or add that code you posted in? Still having trouble removing only blog/press posts from my site. Thanks for your help, it would be much appreciated!

jbrbsx
Visitor
2 0 1

I hope this helps, dawn theme, install "Search & Discovery" - it's completely free, from search and discovery app go to Settings and uncheck "Blog" in what to include in the in-search. like so: 

jbrbsx_0-1701852240952.png

 

zakfinch
Tourist
4 0 3

Thanks for the assistance! Any idea if that works with the 'Impact' theme?

As i've untoggled that box but press/"blog posts" are still showing in search engine.

jbrbsx
Visitor
2 0 1

No idea, but I think it should  maybe wait for 5 minutes?