Skip to main content
  1. All Posts/

jekyll-tools

Tools HTML

Jekyll Tools

A collection of templates I made for my Jekyll-powered blog. I thought that other people might want to use them, so I tossed them up here.
The collection so far:

Social Metadata

The social_metadata.html file is a template for easily adding Open Graph and Twitter Cards metadata for your Jekyll posts. The Liquid markup relies on some settings from your _config.yml file and some settings from the YAML front-matter on each post.

Implementation

  • Place the social_metadata.html file in the _includes folder inside your Jekyll site.
  • Include the file inside the <head> </head> tags on your post pages. Most Jekyll themes make the headers a separate file that is itself included in other templates. It is usually called something like header.html or head.html and usually also lives inside the _includes folder.
  • You can include it with Liquid like this:
{% include social_metadata.html %}

Make sure the following items are defined in your _config.yml file (learn more here). Replace my examples with your own info:

title: Chuck Grimmett's GitHub
url: "" # the subpath of your site, e.g. /blog/
baseurl: "http://example.com" # the base hostname & protocol for your site
locale: en_US # language_territory is the default
theme:
  description: "This is my awesome Jekyll site"
avatar: "/link/to/img.jpg"
twitter: "username" # Don't include @

Make sure the following items are defined in your posts’ front matter:

---
title:
author:
date: YYYY-MM-DD
feature-img: "/link/to/img.jpg"
excerpt: This post is about blah blah blah...
---

Don’t just copy and paste the above blocks. Some of these are probably already in your _config.yml file or your posts’ front matter. Add what is missing to the correct section. Be mindful of indentation.

Validation

Comments via Disqus

The disqus.html is a way to add Disqus commenting to your Jekyll posts. Disqus also provides instructions for an alternative way.

Implementation

Under theme: in your _config.yml file (learn more here), define your Disqus shortname:

theme:
  disqus_shortname: "exampleshortname"

Put this snippet in the post where you want your comments to show up. I put mine at the bottom of my posts template, just before the footer.