Disqus Comments

The file-based structure of Kirby is perfect for handling all your content and articles, but building a file-based comment system isn't really a good idea.

Disqus

Sometimes it is better to build on existing systems rather than reinventing the wheel and a great existing comment system is Disqus.

Disqus has all the features you want from a good comment system: spam protection, multiple login features for your visitors, great admin tools to moderate comments, easy implementation and it is also quite easy to adapt to the design of your site.

Setting up an account with Disqus only takes a few minutes and setting up comments for your site is very straight forward.

Once you've completed the setup process you can adjust multiple settings for your comments. Their docs and descriptions are very good so I won't go too much into detail here.

Adding the Disqus code to your templates

During the setup process on Disqus you will get a javascript code, which you can use to display comments in your templates. It's pretty much like the Google Analytics code, but with slightly more options. You can use their original code in your templates or you can download the snippet, I've created to make the setup a bit easier:

https://github.com/bastianallgeier/kirbycms-extensions/tree/master/snippets/disqus

Download the snippet code and add it to your site/snippets folder

site/snippets/disqus.php

Afterwards you can embed your comments in your pages like this:

<?php snippet('disqus', array('disqus_shortname' => 'myawesomeblog')) ?>

You have to replace the disqus_shortname with the one you selected during the setup process. Afterwards the comment box should show up when you reload the page.

The snippet will automatically take care of setting the right disqus_identifier, disqus_title and disqus_url. If you want to learn more about it, check out the snippet docs

Local development

When you are running your site locally, comments might not show up and instead you get a nasty error message. To get rid of that you can switch on disqus_developer mode like this:

<?php snippet('disqus', array('disqus_shortname' => 'myawesomeblog', 'disqus_developer' => true)) ?>

This makes it possible to run Disqus comments on your localhost.

Further reading

External resources