One way to really take your website or blog to the next level is to include a place for users to add their own comments.  Let’s walk through how to get your site set up for comments using DISQUS.

 

Sign up for a free DISQUS account

The first step is to create a DISQUS account. DISQUS is an online service that allows you to easily integrate comments to your web pages. And the best part is that it’s completely free! 

Find out more about DISQUS here.

 

Add an option for Comments to your Custom Types

Assuming that you already have a working website or blog, go to Custom Types and add the following Select Field to your post custom type.

"allowComments" : {
  "type" : "Select",
  "fieldset" : "Allow Comments?",
  "config" : {
    "label" : "Comments",
    "options" : [ "yes", "no" ],
    "placeholder" : "Select..."
  }
}

 

Integrate the DISQUS code into your templates

All you need to do now is add a simple check that will load the comments section when comments are turned on for a page or post.

Follow the instructions on the DISQUS website for how to install comments using Universal Code, and you will be up and running.

// using pug (formerly Jade) templates

if (postContent.get("post.allowComments") != null && postContent.getBoolean("post.allowComments") == true)

// Add the required code from the DISQUS website

 

Well done!

And there you go. You now have the power to add a comment section to any of your pages or posts. 

Did this answer your question?