Adding Disquss to Gatsby Blog

Ever since reviving my blog I have been planning to add a discussion forum of sorts to it as well. Found Disquss as the right choice for now, although I would have gone for an open sourced alternative but after evaluating the other choices I ended up adding Disquss just to try out the free trial version for now. I might even build an open sourced alternative myself soon if this doesn't work out well for me.

First and foremost, you'll need a Disquss account and register a site so that you can access it via the shortname. A shortname is the unique identifier assigned to a Disqus site. All the comments posted to a site are referenced with the shortname. The shortname tells Disqus to load only your site's comments, as well as the settings specified in your Disqus admin panel.

  1. Register your site here
  2. Enter a sitename to be used as reference
  3. Check the image below

https://res.cloudinary.com/shauryakalia/image/upload/v1656025675/disqus/Screenshot_2022-06-24_at_4.37.17_AM_ssm88s.png

Next step is to open your Gatsby app's codebase and install gatsby-plugin-disqus

yarn add gatsby-plugin-disqus

https://res.cloudinary.com/shauryakalia/image/upload/v1656025058/disqus/Screenshot_2022-06-24_at_3.13.41_AM_y4vefo.png

Once that is done successfully, update your gatsby-config to contain the following

module.exports = {
  plugins: [
    {
      resolve: `gatsby-plugin-disqus`,
      options: {
        shortname: `your-disqus-site-shortname`
      }
    },
  ]
}

https://res.cloudinary.com/shauryakalia/image/upload/v1656025058/disqus/Screenshot_2022-06-24_at_3.15.40_AM_ng17un.png

Lastly, use the following code sample to modify your blog component and setup Disquss as you like.

https://res.cloudinary.com/shauryakalia/image/upload/v1656025057/disqus/Screenshot_2022-06-24_at_3.19.59_AM_aypzt5.png

That's it Folks. It takes about 10 minutes to get a simple smooth discussion platform up and running on your Gatsby blog. Reach out to me if you face any issues or have any doubts.

https://res.cloudinary.com/shauryakalia/image/upload/v1656025058/disqus/Screenshot_2022-06-24_at_4.00.39_AM_veys09.png

blogs