Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to add Disqus comments to the Gatsby Blog #131

Closed
Oppenheimer1 opened this issue Feb 20, 2016 · 3 comments
Closed

Is there a way to add Disqus comments to the Gatsby Blog #131

Oppenheimer1 opened this issue Feb 20, 2016 · 3 comments

Comments

@Oppenheimer1
Copy link

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.

@KyleAMathews
Copy link
Contributor

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.

@Oppenheimer1
Copy link
Author

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(, document.getElementById('container'));

@ElijahLynn
Copy link
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants