Adding Disqus comments to a Jekyll blog
I decided to add Disqus comments to this blog, which is built using Jekyll and hosted on Github. I found that the documentation for how to do this is inaccurate or out of date, so I thought I would write down my own process. I recommend comparing the date of this post to other posts you might find in order to determine which is most likely to be relevant. Fortunately, the latest procedure is even easier than the earlier procedures that have been documented elsewhere.
I am using Jekyll version 3.3.0 and the minima theme.
These come with Disqus comments built into the default _post.html
layout.
They need to be enabled though.
First, go to Disqus, register a shortname for your site, and add your site’s domain to the list of trusted domains.
Now configure your Jekyll setup.
The logic in _post.html
tests whether site.disqus.shortname
has been configured,
and if so, it renders a Disqus comment section at the footer of the page.
To enable this, add the following to
_config.yml
:
disqus:
shortname: yourshortname
where yourshortname
should be replaced with the shortname that you personally
registered. Be sure to use spaces and not tabs for the indentation.
Finally, make sure that your url
and baseurl
variables are set correctly
in your _config.yml
.
The minima theme uses these to configure the disqus_url
variable used to request
the Disqus comments for a particular blog post, and the comments will fail to load
if they are not set correctly.
That’s it—once you push your changes, people should be able to comment on your blog.