How to Handle Schema Markups in Shopify?

Schema markups have become essential for anyone in the Shopify ecosystem who is aiming to achieve top Google rankings. However, schema implementation can be challenging, as it requires technical expertise to configure parameters correctly. Often, schema is either set up improperly or handled through apps that don’t optimize it for the best possible outcomes. In this guide, we'll explain how and where to implement schema markups in your Shopify store to boost your SEO, help your site rank faster, and ensure it passes Google's structured data tests.

Let’s Get Started!

1. Schema Markup for the Homepage

The first schema we’ll address is for your homepage. This schema explains what your business does and includes the most critical details about your Shopify store. It's essential to present this information accurately so that Google understands the core elements of your business.

Schema markup for homepage:

{% if template == 'index' %}

<script type="application/ld+json">

{

"@context": "https://schema.org",

"@type": "LocalBusiness",

"name": "Your business - your business is the best in the market, you sell top notch products and your customers are incredibly satisfied with every purchase.",

"url": "https://yourshopifystore.com/",

"logo": "https://yourshopifystore.com-logo.png?v=1614324715",

"sameAs": [

"https://www.facebook.com/yourshopifystore",

"https://www.youtube.com/channel/12345",

"https://www.instagram.com/yourshopifystore",

"https://www.pinterest.co.uk/yourshopifystore/"

]

}

</script>

{% endif %}

2. Schema Markup for Your Blog

Next is schema markup for your blog page. This markup helps Google understand the general information about your blog, including its name and description. Correct implementation ensures that your blog posts are indexed effectively by search engines.

{%- if template == 'blog' -%}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Blog",
"mainEntityOfPage": {"@type": "WebPage","@id": "{{ shop.secure_url }}{{ blog.url }}"},
"publisher": {
"@type": "Organization",
"name": "{{ shop.name }}",
"description": {{ shop.description | json }}
},
"url": "{{ shop.secure_url }}{{ blog.url }}",
"name": "{{ blog.title }}"
}
</script>
{%- endif -%}

3. Schema Markup for Individual Articles

When it comes to individual articles, schema markup can dynamically show article-specific data, such as the title, author, and publish date. This is crucial for optimizing your blog content for search engines, which helps in driving more organic traffic.


{% if template == 'article' -%}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"mainEntityOfPage": {{ canonical_url | json }},
"url": "{{ shop.secure_url }}{{ article.url }}",
"author": {{ article.author | json }},
"name": {{ article.title | json }},
"publisher": {
"@type": "Organization",
"logo": {"@type": "ImageObject","url": "https:{{ 'logo.png' | asset_url }}"},
"name": {{ shop.name | json }}
},
"headline": {{ article.title | json }},
{%- if article.image -%}
"image": {"@type": "ImageObject","width": 1024,"height": 1024,"url": "https:{{ article | img_url: '1024x1024' }}"},
{%- else -%}
"image": {"@type": "ImageObject","width": 1024,"height": 1024,"url": "https://cdn.shopify.com/s/images/admin/no-image-grande.gif"},
{%- endif -%}
"datePublished": "{{ article.published_at }}",
"dateCreated": "{{ article.created_at }}",
"dateModified": "{{ article.published_at }}",
{%- if article.excerpt.size > 0 -%}"description": {{ article.excerpt | strip_html | json }} {%- else -%}"description": {{ article.content | strip_html | json }} {%- endif -%},"articleBody": {{ article.content | strip_html | json }}
}
</script>
{%- endif -%}

4. Schema Markup for Products

Finally, the product schema markup is critical, as Google utilizes this data in its Merchant Center and search results. Implementing this correctly ensures that your products are displayed with the necessary details, such as availability, price, and SKU, which can positively influence your click-through rate.

{% if template contains 'product' %}
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"name": {{ product.title | strip_newlines | json }},
"image": {{ product.featured_image | img_url: '1024x1024' | prepend: 'https:' | json }},
{% if product.description != blank %}
"description": {{ product.description | strip_html | json }},
{% endif %}
{% if product.vendor %}
"brand": {
"@type": "Brand",
"name": {{ product.vendor | json }}
},
{% endif %}
{% if product.selected_or_first_available_variant.sku != blank %}
"sku": {{ product.selected_or_first_available_variant.sku | json }},
{% endif %}
{% if product.selected_or_first_available_variant.barcode != blank %}
"mpn": {{ product.selected_or_first_available_variant.barcode | json }},
{% endif %}
"offers": {
"@type": "Offer",
"priceCurrency": {{ cart.currency.iso_code | json }},
"price": {{ product.selected_or_first_available_variant.price | divided_by: 100.0 | json }},
"availability": "http://schema.org/{% if product.selected_or_first_available_variant.available %}InStock{% else %}OutOfStock{% endif %}",
"url": "{{ shop.url }}{{ product.selected_or_first_available_variant.url }}",
"seller": {
"@type": "Organization",
"name": {{ shop.name | json }}
},
"priceValidUntil": "2025-12-31"
}
}
</script>
{% endif %}

Conclusion

Accurate implementation of schema markups is crucial for any Shopify store aiming to maximize its visibility on Google. It not only enhances SEO but also helps search engines understand and categorize your content better. Always double-check your code when making changes to avoid errors that could negatively affect your rankings.

By following this guide, you’ll have a solid foundation for applying schema markups in the most impactful areas of your Shopify store, ensuring you stay competitive in search engine rankings.

Feel free to reach out to hello@positronagency.com if you have any questions or need help with schema markups.
Back to blog