Why is my SEO check still failing after I added a meta description in my Shopify settings?
This can happen when there is no title code inside your theme. You can add a title to the theme by following the directions below.
Verify that there is no meta description
- View your website
- Right click and select ‘View Page Source’
- Type Control+F (Command+F on a Mac) to open the search box
- Search for <title> in the file to find the different titles in your theme
- You should see that zero results appear
Create a meta description snippet file
- View your themes in Shopify
- Select ‘Actions’ and ‘Edit code’ for your live theme
- Go the the ‘Snippets’ folder
- Click ‘Add a new snippet’
- Call it 'meta'
- Create snippet
- Add the following piece of code to the new snippet file
<!-- meta.liquid snippet -->
{% assign maxwords = 30 %}
{% if template contains 'product' %}
<meta name="description" content="{{ product.description | strip_html | strip_newlines | truncatewords: maxwords | escape }}" />
{% elsif template contains 'page' %}
<meta name="description" content="{{ page.content | strip_html | strip_newlines | truncatewords: maxwords | escape }}" />
{% elsif template == 'index' %}
{% if shop.description != '' %}
<meta name="description" content="{{ shop.description }}" />
{% endif %}
{% endif %}
Add the meta description to the theme
- Open the theme.liquid file
- Add the following piece of code between the <head></head> tags
{% include 'meta' %}