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

Trying to embed the code from Disqus into my blog site #133

Closed
Oppenheimer1 opened this Issue Feb 21, 2016 · 4 comments

Comments

Projects
None yet
4 participants
@Oppenheimer1
Copy link

Oppenheimer1 commented Feb 21, 2016

I was trying to embed the comment code from Disqus into my blog site, the code below and tried embedding it in multiple ways locally in wrappers/md.js but I haven't been able to get it to work. Any help would be much appreciated.

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://localhost:8000/first-post/"
            category_id="123456"
            onNewComment={this.handleNewComment}/>
    );
}

});

React.render(, document.getElementById('container'));

@KyleAMathews

This comment has been minimized.

Copy link
Contributor

KyleAMathews commented Feb 21, 2016

See how I do it on my blog here: https://github.com/KyleAMathews/blog/blob/master/wrappers/md.cjsx#L51-L54

You shouldn't be calling React.render in a wrapper. Gatsby handles that for you. Just export a component.

@KyleAMathews

This comment has been minimized.

Copy link
Contributor

KyleAMathews commented Feb 26, 2016

Let me know if you need any more help.

@dougajmcdonald

This comment has been minimized.

Copy link
Contributor

dougajmcdonald commented Oct 19, 2017

I did this and it blew up setting url for some reason, removing that worked ok

@hexrcs

This comment has been minimized.

Copy link
Member

hexrcs commented Jul 10, 2018

@dougajmcdonald Mine blew up as well with custom url or identifier - it turned out that I was using the location prop as a string! Changing this.props.location to this.props.location.pathname fixed the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment