Skip to content

Instantly share code, notes, and snippets.

@jnowland
Last active August 2, 2018 16:33
Show Gist options
  • Save jnowland/009029a536158d5f5b72 to your computer and use it in GitHub Desktop.
Save jnowland/009029a536158d5f5b72 to your computer and use it in GitHub Desktop.
{% comment -%}
#----------------------------------
# Meta Details - /Templates/_includes/html.metaDetails.tpl
#----------------------------------
To use this meta template insert the above variables above the include:
{% assign metaTitle = "" -%}
{% assign metaDescription = "" -%}
{% assign metaTags = "" -%}
{% assign metaCategory = "" -%}
{% assign metaTwitterHandle = "" -%}
{% assign metaURL = "" -%}
{% assign metaImage = "" -%}
{% assign metaSiteName = "" -%}
{% assign metaCanonicalURL = "" -%}
{% assign metaFacebookAdminID = "" -%}
{% assign metaTwitterCardType = "" -%}
Always place this data between the 'head' tags of your website.
{% endcomment -%}
{% case metaTwitterCardType -%}
{% when 'summary' -%}
{% assign metaTwitterSize = 'Width=120&Height=120' -%}
{% when 'summary_large_image' -%}
{% assign metaTwitterSize = 'Width=500&Height=270' -%}
{% when 'photo' -%}
{% assign metaTwitterSize = 'Width=640&Height=478' -%}
{% when 'product' -%}
{% assign metaTwitterSize = 'Width=160&Height=160' -%}
{% endcase -%}
<meta name="keywords" content="{{ metaTags }}" >
<meta name="description" content="{{ metaDescription }}" />
{% comment -%} Twitter Card data - Cards can be - summary, summary_large_image, photo {% endcomment -%}
<meta name="twitter:card" content="{{ metaTwitterCardType }}">
<meta name="twitter:site" content="{{ metaTwitterHandle }}">
<meta name="twitter:title" content="{{ metaTitle }}">
<meta name="twitter:description" content="{{ metaDescription }}">
<meta name="twitter:text:description" content="{{ metaDescription }}">
<meta name="twitter:creator" content="{{ metaTwitterHandle }}">
<meta name="twitter:url" content="{{ metaURL }}">
{% comment -%} Twitter Summary card images must be at least 120x120px {% endcomment -%}
<meta name="twitter:image" content="{{ metaImage }}?Action=thumbnail&amp;algorithm=fill_proportional&amp;{{ metaTwitterSize }}">
{% comment -%} Open Graph data {% endcomment -%}
<meta property="og:title" content="{{ metaTitle }}" />
<meta property="og:type" content="article" />
<meta property="og:url" content="{{ metaURL }}" />
<meta property="og:image" content="{{ metaImage }}}?Action=thumbnail&amp;algorithm=fill_proportional&amp;Width=1200&amp;Height=630" />
<meta property="og:description" content="{{ metaDescription}}" />
<meta property="og:site_name" content="{{ metaSiteName }}" />
<meta property="fb:admins" content="{{ metaFacebookAdminID }}" />
{% comment -%} Open Graph Article (Facebook and Pinterest) {% endcomment -%}
<meta property="article:author" content="{{ metaTwitterHandle }}">
<meta property="article:section" content="{{ metaCategory }}">
<meta property="article:tag" content="{{ metaTags }}">
{% comment -%} Publish Times {% endcomment -%}
<meta property="article:published_time" content="{{ this.['releaseDate'] }}">
<meta property="article:modified_time" content="{{ this.['lastupdatedate'] }}">
{% if this.['expiryDate'] != "9999-01-01T00:00:00" -%}<meta property="article:expiration_time" content="{{ this.['expiryDate'] }}">{% endif -%}
<html class="no-js" lang="en">
<head>
{% include "/Templates/_includes/html.header.tpl" -%}
<title>
Example of Use.
</title>
{% comment -%} Meta Details {% endcomment -%}
{% assign metaTitle = this.['Vendor name'] | append: ' - ' | append: this.['General Location'] -%}
{% if this.['SEO Description'] != "" %}
{% assign metaDescription = this.['SEO Description'] -%}
{% else -%}
{% assign metaDescription = this.['Vendor Short Description'] -%}
{% endif -%}
{% assign metaTags = "Example, Tags, BC, Testing" -%}
{% assign metaCategory = "Shoes" -%}
{% assign metaTwitterHandle = "@jnowland" -%}
{% assign metaURL = this.['url'] | prepend: gv_site.domain -%}
{% assign metaImage = this.['Vendor Image'] | prepend: gv_site.domain -%}
{% assign metaSiteName = gv_site.name -%}
{% assign metaCanonicalURL = this.['url'] | prepend: gv_site.domain -%}
{% assign metaFacebookAdminID = "12345678" -%}
{% assign metaTwitterCardType = "photo" -%}
{% include "/Templates/_includes/html.metaDetails.tpl" -%}
</head>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment