在 ReadTheDocs 托管的站点中嵌入 Discourse 评论

大家好,

我一直在尝试将我们论坛的 Discourse 评论添加到我们的文档网站。
我们在 ReadTheDocs 上托管文档。

我使用了来自 Discourse 自定义/嵌入的 JavaScript,但它只会显示“讨论加载中”。

链接:
论坛
Discourse 嵌入 URL(ReadTheDocs 网站)

我检查了页面,在控制台中发现了这条错误消息

无效的 X-Frame-Options: “ALLOWALL” 标头,来自“[https://forum.zenko.io/embed/comments?embed_url=https%3A%2F%…tsInReadTheDocs%2Freference%2Fobject_operations%2Findex.html](https://forum.zenko.io/embed/comments?embed_url=https%3A%2F%2Fzenko.readthedocs.io%2Fen%2Fdocumentation%2FZENKOIO-111-ForumCommentsInReadTheDocs%2Freference%2Fobject_operations%2Findex.html)”,加载到“[https://zenko.readthedocs.io/en/documentation-zenkoio-111-fo…commentsinreadthedocs/reference/object_operations/index.html](https://zenko.readthedocs.io/en/documentation-zenkoio-111-forumcommentsinreadthedocs/reference/object_operations/index.html)”。

如果这有帮助:

请求 URL: https://forum.zenko.io/embed/comments?embed_url=https%3A%2F%2Fzenko.readthedocs.io%2Fen%2Fdocumentation%2FZENKOIO-111-ForumCommentsInReadTheDocs%2Findex.html
请求方法: GET
远程地址: 72.52.80.11:443
状态码:
400
版本: HTTP/2.0

有人遇到过类似问题或能提供帮助吗?

非常感谢!:blush:

5 个赞

Hello Dasha,

I just checked your site in the comment, and as I see you could solve the problem. Can you help me with a short description of how you did it, it seems I have the same problem, and it could be helpful for others too.

Thanks!

3 个赞

Hello @Tokapeb
It’s hard to say what exactly resolved my issue, but as far as I remember I did two things to fix it:

  • added my site’s URL to cors origins on the forum site settings
  • changed discourse embed URI in the script to canonical (it wasn’t before)

Hope it helps :slight_smile:

2 个赞