{"repo":"SukkaW/DisqusJS","free":true,"listed":false,"github":"https://github.com/SukkaW/DisqusJS","clone":"git clone https://github.com/SukkaW/DisqusJS.git","description":":speech_balloon: Render Disqus comments in Mainland China using Disqus API","language":"TypeScript","stars":665,"topics":["disqus","disqus-api","javascript","hexo","hugo","disqusjs","disqusjs-disqus","react","react-component"],"license":"MIT","category":"docs-static-sites","readme_excerpt":"DisqusJS https://disqusjs.skk.moe 纯前端、超轻量级的「评论基础模式」实现：使用 Disqus API 渲染评论列表 简介 DisqusJS 是一个基于 Disqus API 和 React 开发的 Embed 插件。DisqusJS 通过 Disqus API 渲染只读的评论列表，搭配反向代理可以实现在网络审查地区加载 Disqus 评论列表；支持自动检测访客是否能够访问 Disqus、并自动选择加载原生 Disqus（评论完整模式）或 DisqusJS 提供的评论基础模式。 功能 - 判断访客能否访问 Disqus、自动选择「评论基础模式」或「Disqus 完整模式」 - 展示评论列表、支持按照「最新」、「最早」、「最佳」排序 - 可搭配 React（Gatsby、Next.js）使用 Demo - https://disqusjs.skk.moe - https://blog.skk.moe 安装和使用 在 HTML 中直接引入 在你需要安装 DisqusJS 的页面的 之前引入 DisqusJS 的 CSS： 在需要展示评论的地方插入 JS： 接着创建一个 DisqusJS 容器： 通过 NPM 安装 然后在项目中引入 DisqusJS： 注意，你仍然需要手动引入 DisqusJS 的 CSS： --- 使用下述代码初始化一个 DisqusJS 实例。注意初始化需在 DisqusJS 加载完成后进行： 接下来，我们需要让 DisqusJS 实例将评论组件渲染到页面上： 作为 React 组件使用 --- 完成上述步骤后，DisqusJS 就已经在您的站点安装好了，但是你现在还不能使用它。要使用 DisqusJS，你还需要进行一些配置。 配置 Disqus Application 在 Disqus API Application 处注册一个 Application。 点击新创建的 Application，获取你的 API Key（公钥）。 在 Application 的 Settings 页面设置你使用 DisqusJS 时的域名。Disqus API 会检查 API 请求的 Referrer 和 Origin。 配置 DisqusJS 参数 shortname {string} - 你的 Disqus Forum 的 shortname，你可以在 Disqus Admin - Settings - General - Shortname 获取你的 shortname - 必须 ，无默认值 siteName {string} - 你站点的名称，将会显示在「评论基础模式」的 header 中；该配置应该和 Disqus Admin - Settings - General - Website Name 一致 - 非必须，无默认值 identifier {string} - 当前页面的 identifier，用来区分不同页面 - 建议 ，默认值为 document.location.origin + document.location.pathname + document.location.search url {string} - 当前页面的 URL，Disqus 的爬虫会爬取该 URL 获取页面相关信息 - 建议 ，默认值为 document.location.origin + document.location.pathname + document.location.search title {stri","default_branch":null,"files":null,"tree":[],"storefront":"/r/SukkaW","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/SukkaW/DisqusJS/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}