Add comments to your Jekyll powered blog.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Jekyll Blog Comments

Jekyll is a great tool for creating a statically generated blog but out of the box it doesn't have any support for comments.

This repo provides some tools to address that. Specifically;


The jekyll/_includes folder contains three files that you can include from your Jekyll site to render comments, they are;

Copy these to your _includes folder then include them from your blog post layout, e.g. my _layouts/post.html file looks like this;

layout: default
<div class="post {{ page.class }}">
  {% include item.html %}
  {{ page.content }}
  {% include comments.html %}

Configuring Jekyll for the templates

Finally you will need to add this end of your _config.yml so sorting and posting work:

emptyArray: []

  receiver: https://{{your-receiver-site}}/api/PostComment}}

Also add commenting: open to your defaults to switch the new comment form on. You can switch it back off per post by adding commenting: closed to the page or post front matter.

      path: ''
      type: pages
      layout: page
      author: damieng
      commenting: open
      path: '_posts'
      type: posts
      layout: post
      author: damieng
      commenting: open

Optional post-author highlighting

You need to make sure you have an author block for each post author so it can match when an author responds to his own post with additional styling;

    name: Damien Guard

If you do not have an author set on each post/page you can define a default one as shown in an example above.



  • Upload this file to your site
  • Access export-blog-comments.php call from your browser and wait for it to complete
  • Download the /comments/ folder over SSH and then remove it and the export-blog-comments.php from your server
  • Copy the /commments/ folder into your Jekyll _data/ folder



In order to process a new comment do you need a little bit of code running somewhere in the cloud to capture the form post, validate the parameters and write it to your repository. Here's what we have so far:

  • Azure + GitHub creates pull requests against your blog's GitHub repository with the new comment

Implementation notes

Data format

The comments are stored in your Jekyll site in individual yml files with the format _data/comments/{blog-post-slug}/{comment-id}.yml

The blog-post-slug must match the Jekyll slug for the post it relates to while the comment-id can be anything unique.

Each file should look something like this file, _data/comments/wordpress-exporting/12345.yml

id: 12345
name: Damien Guard
gravatar: dc72963e7279d34c85ed4c0b731ce5a9
date: 2007-12-18 18:51:55
message: "This is a great solution for 'dynamic' comments on a static blog!"