简体   繁体   English

Disqus 最近评论小工具

[英]Disqus Recent Comments Widget

Do you know why this script is detected as document.write() on Lighthouse?你知道为什么这个脚本在 Lighthouse 上被检测为 document.write() 吗?

And is it possible to use DOM Manipulation or any alternative ways to solve this problem?是否可以使用 DOM 操作或任何替代方法来解决这个问题?

<script src="https://MyDisqusID.disqus.com/recent_comments_widget.js?num_items=4&hide_avatars=0&avatar_size=32&excerpt_length=200"></script>

Disqus不再支持recent_comments_widget.js ,但作为一种解决方法,您可以使用公共API使用您喜欢的任何时间参数来获取最新评论https://disqus.com/api/docs/posts/list/ ,然后显示评论使用普通JavaScript将数据导入文档中。

When I searched on this to get the recent comments displaying, I found an example that works.当我搜索此以显示最近的评论时,我找到了一个有效的示例。 Not relevant to your issue, but it's related somehow.与您的问题无关,但以某种方式相关。 From which I can say that Disqus still supports this.由此我可以说 Disqus 仍然支持这一点。

 <script type="text/javascript" src="https://gregorys-blog.disqus.com/recent_comments_widget.js?num_items=10&hide_avatars=0&avatar_size=40&excerpt_length=100"></script>

Just replace gregorys-blog with your own Disqus site.只需将gregorys-blog替换为您自己的 Disqus 站点即可。

More reference at: https://www.gregoryalexander.com/blog/2019/10/7/Building-your-own-Disqus-Recent-Comments-Widget更多参考: https://www.gregoryalexander.com/blog/2019/10/7/Building-your-own-Disqus-Recent-Comments-Widget

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM