
This article is going to show you how to integrate the comment service disqus to your gatsbyjs website.
To search your post render file, js, jsx, the name just like PostContent or Post, my site file name is PostContent.js and I’m using casper theme. First of all, I was imported disqus-react component, Github repo, secondly, imported configrations following:
// on the top
import Disqus from 'disqus-react';const PageTemplate: React.FC<PageTemplateProps> = props => {
.... const disqusShortname = "your-disqus-name";
const disqusConfig = {
// make sure your props and set it.
url: config.siteUrl + props.pathContext.slug,
identifier: props.pathContext.slug,
title: post.frontmatter.title,
};
Finally, you need to use component in render callback:
<Disqus.DiscussionEmbed shortname={disqusShortname} config={disqusConfig} />