Skip to content

Instantly share code, notes, and snippets.

@DanRader
Last active December 29, 2016 16:01
Show Gist options
  • Select an option

  • Save DanRader/5dd3985ce37bf0cf1f5d9f147d1c906d to your computer and use it in GitHub Desktop.

Select an option

Save DanRader/5dd3985ce37bf0cf1f5d9f147d1c906d to your computer and use it in GitHub Desktop.
Jekyll Custom SEO tagging that works better with Siteleaf. This is really similar to the Jekyll SEO tag plugin except it lets you override the og image with a custom image if you have one. If there isn't a custom image, it takes whatever image is on the page.
<title>{{ page.title }} - {{site.title}}</title>
<meta property="og:title" content="{{ page.title }}" />
<meta name="description" content="{{ page.excerpt | strip_html }}"/>
<meta property="og:description" content="{{ page.excerpt | strip_html }}"/>
<link rel="canonical" href="{{site.url}}{{page.url}}" />
<meta property="og:url" content="{{site.url}}{{page.url}}" />
<meta property="og:site_name" content="{{site.title}}" />
{% if page.og-image %}
<meta property="og:image" content="{{ site.url }}{{ page.og-image }}" />
{% else %}
<meta property="og:image" content="{{ site.url }}{{ page.image }}" />
{% endif %}
<meta property="og:type" content="article" />
<meta property="article:published_time" content="{{ page.date }}" />
<script type="application/ld+json">
{"@context": "http://schema.org",
"@type": "BlogPosting",
"headline": "{{ page.title }}",
"image": "{{ site.url }}{{ page.image }}",
"datePublished": "{{ page.date }}",
"description": "{{ page.excerpt | strip_html }}",
"url": "{{site.url}}{{page.url}}"}</script>
@DanRader
Copy link
Author

With this set up, you're able to use Siteleafs smart field names so your user can use the 'file fields' and have a more visual selector.

screen shot 2016-12-29 at 10 55 33 am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment