Skip to content

Instantly share code, notes, and snippets.

@sisaacrussell
Forked from joe-dempsey/richsnippet.liquid
Created March 27, 2018 18:13
Show Gist options
  • Save sisaacrussell/5f05539f5c61cb74d431ade74d2512cb to your computer and use it in GitHub Desktop.
Save sisaacrussell/5f05539f5c61cb74d431ade74d2512cb to your computer and use it in GitHub Desktop.
Shopify product richsnippet - structured data markup for Shopify product templates
{% assign current_variant = product.selected_or_first_available_variant %}
<div id="richsnippet">
<div itemscope itemtype="http://schema.org/Product">
<meta itemprop="url" content="{{ shop.url }}{{ product.url }}">
<meta itemprop="image" content="{{ product.featured_image.src | img_url: 'grande' }}">
<meta itemprop="name" content="{{ product.title | escape }}">
<meta itemprop="description" content="{{ product.description | strip_html }}">
{% if product.vendor %}<meta itemprop="brand" content="{{ product.vendor }}">{% endif %}
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<meta itemprop="priceCurrency" content="{{ shop.currency }}">
<meta itemprop="price" content="{{ current_variant.price | money_without_currency }}">
<link itemprop="availability" href="http://schema.org/{% if product.available %}InStock{% else %}OutOfStock{% endif %}">
<meta itemprop="seller" content="{{ shop.domain }}">
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment