Gatsby: 有没有办法将 Disqus 评论添加到 Gatsby 博客

创建于 2016-02-20  ·  3评论  ·  资料来源: gatsbyjs/gatsby

有没有办法将 Disqus 评论添加到 Gatsby 博客? 我正在执行这里的步骤: https ://github.com/gatsbyjs/gatsby 但不确定在哪里合并 Disqus 评论选项。 任何帮助将非常感激。

最有用的评论

Disqus 实际上有一个非常好的 React 组件——https://js.coach/?search =disqus

您只需将其添加到降价包装器( wrappers/md.js )并传入帖子网址。

所有3条评论

Disqus 实际上有一个非常好的 React 组件——https://js.coach/?search =disqus

您只需将其添加到降价包装器( wrappers/md.js )并传入帖子网址。

我找到了我认为需要添加的代码,但不确定应该将其嵌入到 wrappers/md.js 文件的哪个位置。

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}/>
    );
}

});

反应。渲染( , document.getElementById('container'));

因为这是“gatsby disqus comments”搜索的最高结果。 现在这里有一个官方的 react-disqus 组件https://github.com/disqus/disqus-react和一篇关于如何配置的博客文章https://mk.gg/add-disqus-comments-to-gatsby-博客/。 我刚刚使用 gatsby-starter-blog 入门工具包在我的博客上完成了这项工作!

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

brandonmp picture brandonmp  ·  3评论

signalwerk picture signalwerk  ·  3评论

benstr picture benstr  ·  3评论

dustinhorton picture dustinhorton  ·  3评论

jimfilippou picture jimfilippou  ·  3评论