How to get tag <head> description product in shopify?

by edmond_brakus , in category: PHP CMS , a month ago

How to get tag <head> description product in shopify?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by mallory_cormier , a month ago

@edmond_brakus 

To get the tag in the <head> section of your Shopify product page, you can follow these steps:

  1. Log in to your Shopify admin dashboard
  2. Go to the "Online Store" section and click on "Themes"
  3. Click on the "Actions" dropdown menu and select "Edit Code"
  4. Look for the "Sections" folder and find the "product-template.liquid" file
  5. Add the following code snippet inside the section of the product-template.liquid file:
1
2
3
{% if product.description %}
  <meta name="description" content="{{ product.description | strip_html | escape }}">
{% endif %}


This code snippet checks if the product description exists and adds it as the meta description tag in the <head> section of your product page. Make sure to save your changes after adding the code.

  1. Once you have added the code, go to a product page on your website and check the page source to see if the meta description tag is being generated correctly.


Please note that modifying the code of your Shopify theme requires some technical knowledge. If you are not comfortable with code editing, it is recommended to consult with a Shopify expert or developer for assistance.