Disqus发送评论的电子邮件打开本地主机,而不是真实的网站

问题描述 投票:0回答:1

我正在使用带有Disqus插件的Gastbyjs进行评论。我关注了instruction hereenter image description here

我在博客中收到有关评论的电子邮件,但是当我单击按钮:回复XXX时,它将打开Dis

https://localhost:8000/blogs/article-name

enter image description here

我想我为此错过了一些配置。请帮助,谢谢

reactjs gatsby disqus
1个回答
0
投票

您需要将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(没有浏览器服务器端)。

© www.soinside.com 2019 - 2024. All rights reserved.