我正在使用带有Disqus插件的Gastbyjs进行评论。我关注了instruction here
我在博客中收到有关评论的电子邮件,但是当我单击按钮:回复XXX时,它将打开
我想我为此错过了一些配置。请帮助,谢谢
您需要将url
传递到当前页面Disqus所在的disqusConfig
。在Gatsby中,由于使用了@ reach / router,因此可以期望在每个页面上都可以使用定位道具。
在您的组件中:
let disqusConfig = {
url: props.location.href,
identifier: props.your.identifier.source,
title: props.your.title.source,
};
和:
return (
<div className="article">
<h1>Article title</h1>
<div>Article text</div>
<Disqus config={disqusConfig} />
</div>
)
插件配置:
{
resolve: `gatsby-plugin-disqus`,
options: {
shortname: `your-short-name`
}
}
注意:您不能使用window.location
之类的东西,因为在构建期间没有window
(没有浏览器服务器端)。