Hi, I’ve been trying to find a way to remove the blog posts and pages from showing up in the internal search results on our website. I found similar questions posed on Community but they’re for different theme.
The solution suggested was to add this <input type=“hidden” name=“type” value="product’> below {{ routes.search_url }} in the main-search.liquid file
Our theme is Xtra and so far this is the code that I’m looking at under that main-search.liquid file:
</header>
<form action="{{ routes.search_url }}" method="get" class="f8se no-js">
<p class="m10">{{ 'search.amount_of_results' | t: count: search.results_count, amount: search.results_count }}</p>
<p>
<label for="fea" class="hidden">{{ 'search.title' | t }}</label>
<input type="search" id="fea" name="q" placeholder="{{ 'search.search_form.placeholder' | t }}" autocomplete="off" required {% if search.performed %}value="{{ search.terms }}"{% endif %}>
<button type="submit">{{ 'search.search_form.submit' | t }}</button>
</p>
</form>
{%- liquid
if sorting_block == nil and show_filters_and_menu
render 'filters-sorting', display: 'mobile-filter-button', sticky: section.settings.filter_mobile_sticky, show_filters: show_filters
endif
-%}
{%- when 'sorting' -%}
{%- render 'filters-sorting',
display: 'sorting',
sticky: section.settings.filter_mobile_sticky,
show_filters: show_filters,
origin: "search",
object: search,
show_amount_of_products: section.settings.show_amount_of_search_results,
collection_view: collection_view
-%}
{%- when 'results' -%}
{% paginate search.results by section.settings.pagination_qty %}
{%- liquid
assign products = search.results | where: 'object_type', 'product'
assign articles = search.results | where: 'object_type', 'article'
assign pages = search.results | where: 'object_type', 'page'
-%}
{%- if section.settings.pagination_type == 'button' and paginate.previous %}
{% render 'pagination',
paginate: paginate,
pagination_type: section.settings.pagination_type,
prev_button: true
%}
{%- endif -%}
<div class="results">
{%- if products.size > 0 -%}
<ul id="collection" class="l4cl {% if settings.enable_quick_buy %}with-quick-buy{% endif %}{% if collection_view == 'list' %} list{% endif %}{% unless show_filters_and_menu %} mobile-wide{% endunless %}{% if section.settings.products_per_row_mobile == '1' %} w100-mobile{% endif %}" {{ block.shopify_attributes }}>
{%- for product in products -%}
{%- liquid
capture placeholder_int
cycle 1, 2, 3, 4, 5, 6
endcapture
-%}
{%- render 'product-item',
product: product,
placeholder_int: placeholder_int,
width_class: width_class,
type: 'both',
quick_buy_compact: section.settings.enable_quick_buy_compact,
enable_quick_buy_desktop: section.settings.enable_quick_buy_desktop,
enable_quick_buy_mobile: section.settings.enable_quick_buy_mobile,
enable_quick_buy_qty_selector: section.settings.enable_quick_buy_qty_selector,
enable_quick_buy_drawer: section.settings.enable_quick_buy_drawer,
enable_color_picker: section.settings.enable_color_picker
sizes: image_sizes
-%}
{%- endfor -%}
</ul>
{%- endif -%}
{%- if pages.size > 0 -%}
<hr>
{%- for page in pages -%}
<div>
<header>
<h3><a href="{{ page.url }}">{{ page.title }}</a></h3>
</header>
{{ page.content | strip_html | truncatewords: 50 }}
</br><a href="{{ page.url }}" class="strong">{{ 'general.read_more.read_more' | t }} <i aria-hidden="true" class="icon-chevron-right"></i></a>
</div>
{% unless forloop.last and articles.size == 0 %}
<hr>
{% endunless %}
{%- endfor -%}
{%- endif -%}
{%- if articles.size > 0 -%}
{%- if pages.size == 0 -%}<hr>{%- endif -%}
<ul class="l4ne">
{%- for article in articles -%}
{%- render 'article-item',
article: article, show_excerpt: section.settings.show_excerpt, show_image: section.settings.show_image, show_date: section.settings.show_date, show_author: section.settings.show_author, show_link: section.settings.show_link_post, button_color_palette: section.settings.button_color_palette_post
-%}
{%- endfor -%}
</ul>
{%- endif -%}
</div>
{% render 'pagination',
paginate: paginate,
pagination_type: section.settings.pagination_type,
show_amount: section.settings.show_amount_of_search_results
%}
{% endpaginate %}
{%- endcase -%}
{%- endfor -%}
{%- if show_filters_and_menu -%}</div>{%- endif -%}
{% if show_filters_and_menu %}
<aside>
{%- render 'filters-sorting',
display: 'filters',
show_filters: show_filters,
filters: search.filters,
quick_links: quick_links,
filters_show_more_limit: section.settings.filters_show_more_limit
-%}
</aside>
{% endif %}
</div>
Where should I add this specific code <input type=“hidden” name=“type” value="product’> ? Or if I should be using that code in the liquid file?
I’m very new to this (so the usage of terms may be wrong - so forgive me for this) and coding isn’t exactly my niche so I would need any help with this.
Thanks!

