Hello. I am trying to figure out how to set meta description on search pages within my store.
Would that work with:
{% if template contains 'search' %}
Within theme.liquid file, or there is another solution for another file like search.liquid or others?
@AlbertBenj ,
If you want to add meta description only for search page.
You can add the code in theme.liquid file like this
{% if template == ‘search’ %}
add meta description code here
{% endif %}
Hi @AlbertBenj ,
Your submitted code works perfectly fine in this case:
{% if template contains ‘search’ %}
{% endif %}
You can add it at layout/theme.liquid file. Ex: https://i.imgur.com/018DSfc.png
If my answer can help you solve your issue, please mark it as a solution. Thank you and good luck
@LitExtension Thanks. I am looking to enable search pages to be crawled by search engines. Any advice or thoughts before doing that?
What I know so far:
Pros:
-important advantage for crawling different keywords
Cons:
-the URL structure is pretty long
-faster wasted crawl budget
I think you should refer to how Dawn works, it will be more optimized: https://github.com/Shopify/dawn/blob/main/snippets/meta-tags.liquid
I don’t think the search page should be crawled too much. This is only personal advice, it depends on your product and store.
Hope it helps!
1 Like