Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
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' %}
<meta name="description" content=" text ... text ">
Within theme.liquid file, or there is another solution for another file like search.liquid or others?
Solved! Go to the solution
This is an accepted solution.
Hi @AlbertBenj,
Your submitted code works perfectly fine in this case:
{% if template contains 'search' %}
<meta name="description" content=" text ... text ">
{% 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
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 %}
This is an accepted solution.
Hi @AlbertBenj,
Your submitted code works perfectly fine in this case:
{% if template contains 'search' %}
<meta name="description" content=" text ... text ">
{% 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!
User | RANK |
---|---|
44 | |
42 | |
23 | |
20 | |
13 |