Gareth Redfern developer, cyclist & coffee lover

Setting Up Disqus Comments With Statamic

Posted by Gareth Redfern
Category: statamic

I knew that there are a couple of variables in the denali theme file which were Disqus related and I had also seen that there is a Statamic plugin which is called in the denali post file. I figured all I should need to do is set those variables, add the call to the disqus plugin in my my post file and away we go. It turns out that it really is that simple to add Disqus to your blog using Statamic’s pre installed Disqus plugin. So here are the steps you should follow.

Create A Site Within Disqus

  1. Go to the Disqus website and sign up for an account. Once you have done this, login, and under the “Your Sites” section on the left click on the +Add button.
  2. Enter the url for your website, site name, and a site short name (make a note of this short name as you need it in your Statamic variables file later).
  3. Click continue, and you are already to go, there are numerous settings within Disqus but I will leave you to experiment with them.

Setting Up Statamic

In your theme.yaml file you should see two variable settings under Comments + Disqus. Change the disqus_account variable to your site short name that you noted down before and set the show_comments variable to yes. If you do not have these variables just create a comment that says something like #Comments + Disqus and then under that create two variables on separate lines which look like this:

disqus_account: shortname

show_comments: no

If you are struggling you can always take a look at my Satarkers theme.yaml file as an example.

Important

As of version 1.4.2 (current version as of this post date) you will need to change the code in the Disqus plugin as there is a line of code missing which Jack kindly helped with. This is really easy to do though, just locate the disqus folder in the _add-ons folder and overwrite the code in the pi.disqus.php file with the code I have saved here. You will see from the comments in my support question that this will be fixed in version 1.5, so if you are reading this after that version release then you can ignore this last part.

To Finish Up

It does say in the Disqus help section that if you are using Disqus on a domain other than the one you set in the settings area when you created the site then the comments box will not show. I found it still worked when I used the site locally, still one to watch out for if you see the “Powered by Disqus” text but no comments. Other than that this was really easy to set up and something that you can easily incorporate on your blog.