How to set meta description for search pages

Solved
AlbertBenj
Excursionist
15 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?

0 Likes
IttantaTech
Shopify Partner
488 52 87

@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
0 Likes

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 - #1 Shopping Cart Migration Expert
If our answer is helpful then please accept as solution!
Are you looking for a solution to migrate to Shopify? Contact us for further assistance.
Try our FREE DEMO now!
0 Likes
AlbertBenj
Excursionist
15 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

0 Likes

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 - #1 Shopping Cart Migration Expert
If our answer is helpful then please accept as solution!
Are you looking for a solution to migrate to Shopify? Contact us for further assistance.
Try our FREE DEMO now!