这里有一篇关于如何通过 Embed Discourse comments on another website via Javascript 嵌入评论的优秀帖子。不过,有些社区的网站访问者可能未启用 JavaScript。若非如此,我认为从 SEO 的角度来看,应当有一种无需 JavaScript 即可嵌入网站评论的方法。
经过一番尝试,我发现其实可以用一种更简单的方式轻松实现,完全不需要 JavaScript。只需遵循以下步骤:
<iframe id="discourse-embed-frame" scrolling="no" referrerpolicy="no-referrer-when-downgrade"
src="https://<DISCOURSE_URL>/embed/comments/?embed_url=<WEBSITE_PAGE_URL>%2F&discourse_username=system"
width="100%" height="3271px" frameborder="0"></iframe>
例如:
<iframe src="https://meta.discourse.org/embed/comments?embed_url=https%3A%2F%2Fblog.discourse.org%2F2021%2F05%2Fdiscord-and-discourse-better-together%2F&discourse_username=rishabh"
id="discourse-embed-frame" scrolling="no" referrerpolicy="no-referrer-when-downgrade"
width="100%" height="3271px" frameborder="0"></iframe>
有什么理由会导致这种方法无法工作吗?