Disqus and Next.js

Disqus and Next.js

In this post, you will learn how to add comments to your Next.js project. And it is easy with Disqus.

First, create an account on Disqus.

Second, go to the https://disqus.com/profile/signup/intent/ and press "I want to install Disqus on my site", fill-up the form, and remember the short name (it will be useful later).

Third, install the disqus-react package from npm. If you are a Typescript user, this package already has typings.

npm install disqus-react

And use it like this:

import { DiscussionEmbed } from "disqus-react"

<DiscussionEmbed
  shortname={"remember that short name from second step?"}
  config={{
    url: "this page url",
    identifier: "unique identifier of this page",
    title: "this page title"
  }}
/>

You can find a usage example here: comments.tsx