If you are using Jekyll like me, you know that it is a static site which is not backed by a database. So there is no way of getting storing comments. Disqus is a service that lets you embed a little bit of code to achieve commenting feature on your website.

Register on Disqus

The first thing you need to do is to head to disqus.com and register. Then add a site on the admin page and fill in information about your site. Remember your disqus shortname because you will need it later.

Add an include page

Add the following code to _includes/disquq-comment.html:

{% if page.comments %}
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = "http://BLOG.host.com{{ page.url }}"; // <--- use canonical URL
this.page.identifier = "{{ page.id }}";
};
(function() {
var d = document, s = d.createElement('script');

s.src = '//SHORTNAME.disqus.com/embed.js'; // <-- replace with your Disqus shortname

s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
{% endif %}

Don’t forget to replace SHORTNAME with your own Disquq shortname.

Include Disqus in layout

Add the following line to where you want to display comments, for example, _layouts/post.html.

{% include disqus.html %}

Enable comment in posts

Add the following line to the YAMP front matter of posts that you want to enable comments on.

comments: true

Your front matter should look like this:

---
layout: post
comments: true
title:  "My awesome blog title"
date:   2017-03-28 012:27:57 +0900
categories: jekyll disqus
---

You should now see Disqus on your posts. Happy blogging!