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

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

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

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

Oppenheimer1 opened this issue Feb 21, 2016 · 4 comments

Comments

@Oppenheimer1
Copy link

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
Copy link
Contributor

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
Copy link
Contributor

Let me know if you need any more help.

@dougajmcdonald
Copy link
Contributor

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

@hexrcs
Copy link
Contributor

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.

ChristopherBiscardi added a commit to ChristopherBiscardi/gatsby that referenced this issue Jun 27, 2019
* Made componentWithMDXScope a no-op. It is deprecated and doesn't
  need to be used any more. MDXRenderer is still required for previous
  uses that required it.
* Scopes are now imported via custom webpack loader
  - TODO: rename mdx-scopes to the loaders dir
* Scopes are now merged into a single scope and injected into
  wrapRootElement on both SSR and Browser renders
* Querying code.scope is now a no-op
  - No files are written when this happens
* Relative path import support is added to all MDX Nodes

closes gatsbyjs#214 gatsbyjs#202 gatsbyjs#133
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

4 participants