FROM CACHE - en_header

How to set meta description for search pages

Solved
AlbertBenj
Excursionist
23 0 0

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?

Accepted Solution (1)

Accepted Solutions
LitExtension
Shopify Partner
4655 950 974

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 - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify

View solution in original post

Replies 4 (4)
IttantaTech
Shopify Partner
525 55 98

@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 %}

 

Thanks,
Ittanta Technologies Pvt. Ltd. | Shopify Expert
If reply is helpful, please Like and Accept Solution.
To hire us, contact us at info@ittanta.com
LitExtension
Shopify Partner
4655 950 974

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 - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
AlbertBenj
Excursionist
23 0 0

@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

LitExtension
Shopify Partner
4655 950 974

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!

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify