One of the issues that I needed to face when I decided to move my blog from
GitHub Pages using
Jekyll is how to preserve comments on posts.
Please welcome Disqus
Disqus is a discussion (or forum) platform that can be integrated in any content available on the web.
In order to integrate something with Disqus the only requirement is that
the something can be uniquely identified, and a blog post
permalink is an amazing unique identifier :-)
One of the interesting things that Disqus can do is to integrate itself with Blogger and keep blog post comments synchronized with Disqus comments. Automatically Discqus will utilize the post
permalink as the comments unique identifier.
Once Disqus is in sync with Blogger the blog content can be safely moved to another platform.
Adding Disqus to Jekyll
Adding Disqus to Jekyll is as easy as adding the following snippet to the Jekyll post template:
But for imported posts it is not enough, comments won’t show up using the above, the commenting form will be displayed but existing comments no. The issue is that the Blogger generated
permalink is not the same as the Jekyll one:
easy peasy, once again.
to identify the Blogger original URL, what I simply did is to update each imported post adding a
permalink header as well:
blogger_orig_url: http://milestone.topics.it/2013/04/ravendb-worker-role-on-windows-azure.html permalink: /2013/04/ravendb-worker-role-on-windows-azure.html
permalink header, when used at the post level, overrides the Jekyll default
permalink generation behavior for that specific post adding 2 great benefits to the new blog:
- Old links are still supported, so all the posts linked anywhere will work as expected;
- Synchronized Disqus comments show up appended to the posts they belong to;