jekyll-tools
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:
- A template for adding social metadata (Open Graph and Twitter Cards) to posts and pages
- A template for adding Disqus comments
- A template for listing posts by tag
- A posts heatmap calendar
- Options for Search on a Jekyll site
- A template for filtering categories with Isotope
- A Jekyll Collection template for Book Reviews, complete with star ratings
- Moving your Jekyll Site to Amazon S3 and Cloudfront with Outside DNS
- Moving WordPress posts to Jekyll
- Improving Jekyll Build Time
- Building a reading list with Jekyll data files
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 likeheader.html
orhead.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
- Validate your Open Graph metadata with Facebook’s Debugger
- Validate your Twitter Cards with Twitter’s Card Validator
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
-
Put the
disqus.html
file in the_includes
folder inside your Jekyll site. - Register your site on Disqus
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.