As I wrote earlier, I migrated my blog from Wordpress to static Jekyll website. I really like the static website as a concept as it makes the site maintenance less complicated and straightforward. However, being a static site, there is no native support for adding dynamic features such as post commenting.
Luckily, there is easy way to add commenting to static sites using external services such as Disqus.
Here’s a step-by-step guide for adding Disqus commenting on Jekyll site.
Create Disqus account
Register to Disqus and add your first website. Disqus will ask a shortname for your site and opens the site settings page. Enter site URL and name.
Next go to Disqus installation page and copy Universal Code snippet to text editor.
All done on Disqus, next we need to edit Jekyll template to enable commenting.
Modify Jekyll post template
Open the appropriate post template from your Jekyll project. On the Clean Blog theme the post template file is /_layouts/post.html. Add the copied Universal Code snipped inside {% if page.comments %} and {% endif %} liquid tags.
Uncomment the recommended configurations and update variables so that the correct information is picked up from Jekyll configuration:
All done here, now Jekyll is ready to show comments for posts where commenting is enabled.
Enabled comments on posts
Now all you need to do is to go through your post markdown files, and add “comments: true” into the post FrontMatter configuration headers.
Once done, reload pages, and Disqus commenting will be enabled.