Closed Oppenheimer1 closed 8 years ago
There's actually a really nice React component for Disqus — https://js.coach/?search=disqus
You'll just want to add that to the markdown wrapper (wrappers/md.js
) and pass in the post url.
I found the code I think I need to add but wasn't sure where I should embed it within the wrappers/md.js file.
var React = require('react'); var ReactDisqusThread = require('react-disqus-thread');
var App = createClass({
handleNewComment: function(comment) {
console.log(comment.text);
}
render: function () {
return (
<ReactDisqusThread
shortname="example"
identifier="something-unique-12345"
title="Example Thread"
url="http://www.example.com/example-thread"
category_id="123456"
onNewComment={this.handleNewComment}/>
);
}
});
React.render(
Since this comes up as top result for "gatsby disqus comments" search. There is now an official react-disqus component here https://github.com/disqus/disqus-react and a blog post on how to configure here https://mk.gg/add-disqus-comments-to-gatsby-blog/. I just got this working on my blog using the gatsby-starter-blog starter kit!
Is there a way to add Disqus comments to the Gatsby Blog? I was walking through the steps here: https://github.com/gatsbyjs/gatsby but wasn't sure where to incorporate the Disqus comment option. Any help would be much appreciated.