I previously used this post to hide certain pages from storefront search and it worked. But when I updated my Studio theme to version 11.0.0 from 10.0.0, it stopped working and these pages are now showing on my storefront search again. This is how my code looks currently. Can anyone help with this?
{%- for item in search.results -%}
{% assign lazy_load = false %}
{%- if forloop.index > 2 -%}
{%- assign lazy_load = true -%}
{%- endif -%}
{% unless item.metafields.custom.hide_from_storefront_search == 1 %}
- {%- case item.object_type -%}
{%- when 'product' -%}
{%- capture product_settings -%}{%- if section.settings.product_show_vendor -%}vendor,{%- endif -%}title,price{%- endcapture -%}
{% render 'card-product',
card_product: item,
media_aspect_ratio: section.settings.image_ratio,
image_shape: section.settings.image_shape,
show_secondary_image: section.settings.show_secondary_image,
show_vendor: section.settings.show_vendor,
show_rating: section.settings.show_rating,
lazy_load: lazy_load
%}
{%- when 'article' -%}
{% render 'article-card',
article: item,
show_image: true,
show_date: section.settings.article_show_date,
show_author: section.settings.article_show_author,
show_badge: true,
media_aspect_ratio: 1,
lazy_load: lazy_load
%}
{%- when 'page' -%}
###
{{ item.title | truncate: 50 | escape }}
{{ 'templates.search.page' | t }}
{%- endcase -%}
{% endunless -%}
{%- endfor -%}