Skip to content

Instantly share code, notes, and snippets.

@dinhnguyen
Created November 16, 2015 07:12
Show Gist options
  • Save dinhnguyen/1d487893096f17dfc158 to your computer and use it in GitHub Desktop.
Save dinhnguyen/1d487893096f17dfc158 to your computer and use it in GitHub Desktop.
<meta property="og:url" content="{{ canonical_url }}">
<meta property="og:site_name" content="{{ store.name }}">
{% if template contains 'product' %}
<meta property="og:type" content="product">
<meta property="og:title" content="{{ product.name | strip_html }}">
{% for image in product.images limit:1 %}
<meta property="og:image" content="http:{{ image.src | img_url: 'grande' }}">
<meta property="og:image:secure_url" content="https:{{ image.src | img_url: 'grande' }}">
{% endfor %}
<meta property="og:price:amount" content="{{ product.price | money_without_currency }}">
<meta property="og:price:currency" content="{{ store.currency }}">
{% elsif template contains 'article' %}
<meta property="og:type" content="article">
<meta property="og:title" content="{{ article.title | strip_html }}">
{% if article.image != null %}
<meta property="og:image" content="http:{{ article.image.src }}">
<meta property="og:image:secure_url" content="https:{{ article.image.src }}">
{% endif %}
{% else %}
<meta property="og:type" content="website">
<meta property="og:title" content="{{ page_title }}">
{% if settings.brand_type == 'image' %}
<meta property="og:image" content="http:{{ 'logo.png' | asset_url }}">
<meta property="og:image:secure_url" content="https:{{ 'logo.png' | asset_url }}">
{% endif %}
{% endif %}
{% if page_description %}
<meta property="og:description" content="{{ page_description }}">
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment