So, I’ve finally got Disqus comments working properly on this blog.

I’d read several guides, including the one from GitHub pages, Jekyll itself, and Disqus, but I was continuously encountering the same issue; the Disqus comments box wasn’t showing! It would show when I built and served the site locally, but when it was pushed to GitHub, no comments!

While I don’t receive many (read any) comments, I still think it’s a worthwhile feature to have on a blog. It allows for interaction between readers and the author, and opens the forum for discussions.

Back to the issue… Jekyll uses layout files to template a site. The blog posts on this site use the post.html template in the _layouts folder. Templates can have .yml front matter that, I assumed, would be applied to all posts… although I’m questioning that assumption now. This was the front matter from post.html:

---
layout: default
comments: true
---

comments: true is the front matter required for enabling comments on a page, and I thought it’d propagate through to the individual posts. It certainly did on my local machine, so why not online? Once I moved comments: true from the layout front matter to the individual post front matter; voila… Comments.

Individual post front matter:

---
layout: post
title:  "Getting Disqus comments to work on Jekyll"
date:   2016-08-26 13:18:31
categories: jekyll disqus
comments: true
---

So, yeah… Jekyll’s cool for building static blogs, but having things work in one environment and not others isn’t fantastic. Not sure if it’s Jekyll’s fault, or GitHub pages set up, but it’s frustrating either way.

I’m going to have to look into whether any front matter is shared from the layouts, or whether I dreamt that up…