Skip to content

Instantly share code, notes, and snippets.

@chrisjhoughton
chrisjhoughton / fb-open-graph.liquid
Last active September 9, 2023 07:52
Facebook Open Graph meta tags for Shopify. Add this as a snippet called "fb-open-graph.liquid" in your theme, and then add {% include 'fb-open-graph' %} to your theme.liquid file.
{% if template contains 'product' %}
<meta property="og:type" content="product">
<meta property="og:title" content="{{ product.title | strip_html | escape }}">
<meta property="og:category" content="{{ product.type }}" />
{% for image in product.images limit:3 %}
<meta property="og:image" content="http:{{ image.src | product_img_url: 'master' }}">
<meta property="og:image:secure_url" content="https:{{ image.src | product_img_url: 'master' }}">
{% endfor %}
<meta property="og:price:amount" content="{{ product.price | money_without_currency | stip_html | escape | remove: ',' }}">
<meta property="og:price:currency" content="{{ shop.currency }}">
@Chrisedmo
Chrisedmo / snippet-fb-open-graph-tags.liquid
Created August 21, 2012 11:12
Shopify: Facebook OG Tags
{% comment %}
This is for widgets that share content on Facebook.
See the Facebook Linter: http://developers.facebook.com/tools/debug
{% endcomment %}
{% if template contains 'product' %}
<meta property="og:url" content="{{ shop.url }}{{ product.url }}" />
<meta property="og:title" content="{{ product.title }}" />
<meta property="og:description" content="{{ product.description | strip_html | truncatewords: 100, '' | escape }}" />
<meta property="og:image" content="{{ product.featured_image | product_img_url: 'medium' }}" />