Skip to content

Instantly share code, notes, and snippets.

@jdsimcoe
Created July 22, 2015 23:58
Show Gist options
  • Save jdsimcoe/a1c0ffe76675a5e5553e to your computer and use it in GitHub Desktop.
Save jdsimcoe/a1c0ffe76675a5e5553e to your computer and use it in GitHub Desktop.
Statamic Open Graph solution.
{{ var:description }}
{{ if description }}{{ description }}
{{ else }}
{{ truncate:words limit="66" }}
{{ if blog__content }}{{ blog__content|striptags }}
{{ elseif profile__bio }}{{ profile__bio|striptags }}
{{ elseif session__type }}{{ content|striptags }}
{{ /if }}
{{ /truncate:words }}
{{ /if }}
{{ /var:description }}
<meta name="description" content="{{ var:description }}">
<meta itemprop="description" content="{{ var:description }}">
<meta name="twitter:description" content="{{ var:description }}">
<meta property="og:description" content="{{ var:description }}">
<meta name="description" content="{{ description or content|truncate:200 }}">
<meta itemprop="description" content="{{ description or content|truncate:200 }}">
<meta name="twitter:description" content="{{ description or content|truncate:200 }}">
<meta property="og:description" content="{{ description or content|truncate:200 }}">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment