13 KiB
title: Icarus用户指南 - 评论系统 date: 2017-01-31 categories:
- Plugins
- Comment tags:
- Icarus用户指南 language: zh-CN toc: true
本文介绍Icarus 3支持的一些用户评论插件的安装配置。
Icarus的用户评论插件由ppoffice/hexo-component-inferno 提供,具体提供的插件种类与配置以其为准。
畅言
安装指南
-
从获取的PC端代码中复制
appid
与conf
值到Icarus主题配置文件的评论配置项中。 例如,获取到的如下的PC端代码:<!--PC版--> <div id="SOHUCS" sid="..."></div> <script charset="utf-8" type="text/javascript" src="https://cy-cdn.kuaizhan.com/upload/changyan.js" ></script> <script type="text/javascript"> window.changyan.api.config({ appid: '????appid????', conf: 'prod_xxxxxxxxxxxxxxxxxxxxxxx' }); </script>
对应到主题配置文件中的配置项为:
{% codeblock themes/icarus/_config.yml lang:yaml %} comment: type: changyan app_id: ????appid???? conf: prod_xxxxxxxxxxxxxxxxxxxxxxx {% endcodeblock %}
-
另外,畅言云评要求站长对使用其评论服务的网站进行备案,详情请参阅 ICP备案文档。
Disqus
-
首先,注册并登录Disqus,点击首页的“开始”(GET STARTED)按钮或者访问 此处并点击“我想要将Disqus安装到我的站点” (I want to install Disqus on my site)来创建新的站点评论服务。
-
在创建新站点页面中填写网站名称(Website Name)以及网站类型(Category),然后点击“创建站点”(Create Site)。
-
下一步,选择Disqus的安装平台。此处选择最下方的“上面没有列出我使用的平台,使用通用代码安装” (I don't see my platform listed, install manually with Universal Code)。
-
点击最下方的“配置”(Configure)按钮跳过通用代码安装指南(Universal Code install instructions)页面。 在“配置Disqus”(Configure Disqus)页面中按需填写Disqus个性化配置。点击“完成安装”(Complete Setup) 和“关闭配置”(Dismiss Setup)来结束配置。
-
最后,在评论站点首页的右上角点击“编辑配置”(Edit Settings),进入到站点配置页面。 在页面上找到Shortname配置值并复制到主题配置文件相应的评论配置项中(
comment
下的shortname
)。 例如,下图中的Shortname为test-usildmkxo
{% asset_img disqus-general-settings.png "General Settings - Disqus Admin" %}
复制到配置文件中为
{% codeblock themes/icarus/_config.yml lang:yaml %} comment: type: disqus shortname: test-usildmkxo {% endcodeblock %}
-
(可选)你可以在文章的头部加入
disqusId
来为文章添加Disqus唯一标识。这样如果文章之后被移动或者链接更改,其 评论也不会随之丢失。{% codeblock source/_post/some-post.md lang:markdown %} title: My first post date: 2015-01-01 00:00:01 disqusId: some-disqus-id
Hello world
{% endcodeblock %}
DisqusJS
DisqusJS适用于原版Disqus服务访问受限的地区使用。关于DisqusJS的配置过程可参考 https://github.com/SukkaW/DisqusJS。
-
登录Disqus并打开此链接,点击“注册新应用”(Register new application)或者“注册应用”(registering an application)。
-
在打开的页面中填写应用名称(Label),介绍(Description),以及网站地址(Website),然后点击“注册我的应用” (Register my application)。
-
应用创建完毕后进入设置界面(Settings),在域名(Domains)输入框中填入你的网站域名,例如ppoffice.github.io。 点击页面下方的“保存设置”(Save Changes)按钮。
-
点击页面中上放的“详情”(Details)链接切换到当前应用的主页,从下方OAuth设置(OAuth Settings)中复制API Key 到相应的主题配置项(
comment
下的api_key
)中。下面是示例配置:{% codeblock themes/icarus/_config.yml lang:yaml %} comment: type: disqusjs shortname: test-usildmkxo api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx api: https://disqus.skk.moe/disqus/ # 可选填 admin: ppoffice # 可选填 admin_label: Admin # 可选填 nesting: 4 # 可选填 {% endcodeblock %}
-
关于上述配置的含义和可选值,请参考SukkaW/DisqusJS官方文档或 hexo-component-inferno中的配置项描述。
-
Facebook的评论服务配置较为简单,仅需在主题配置中将
comment
的type
设置为facebook
即可。 需要注意的是,部分广告拦截插件会将Facebook评论拦截,请酌情使用。{% codeblock themes/icarus/_config.yml lang:yaml %} comment: type: facebook {% endcodeblock %}
Gitalk
-
登录GitHub并点此注册一个新的OAuth应用。在填写相应的应用名称 (Application name),应用主页(Homepage URL),应用描述(Application description)后,在认证回调地址(Authorization callback URL)填写你的博客的根URL地址。
-
点击“注册应用”(Register application)后,在应用详情界面复制Client ID与Client Secret并填入主题配置的相应配置项中。 例如,对于下面的Client ID和Client Secret
{% codeblock GitHub OAuth Application %} Client ID xxxxxxxxxxxxxxxxxxxx Client Secret xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {% endcodeblock %}
Gitalk在Icarus的配置为
{% codeblock themes/icarus/_config.yml lang:yaml %} comment: type: gitalk client_id: xxxxxxxxxxxxxxxxxxxx client_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx repo: Some-of-Your-GitHub-Repo owner: you_github_name admin: - you_github_name per_page: 20 # 可选填 distraction_free_mode: false # 可选填 pager_direction: last # 可选填 create_issue_manually: false # 可选填 proxy: # 可选填 flip_move_options: # 可选填 enable_hotkey: true # 可选填 {% endcodeblock %}
-
关于上述配置的含义和可选值,请参考Gitalk官方文档或hexo-component-inferno 中的配置项描述。
Gitment
安装指南
-
参照上面Gitalk中关于注册GitHub OAuth应用的步骤注册应用,并将Client ID与Client Secret并填入主题配置的相应配置项中。 下面是Gitment的示例配置:
{% codeblock themes/icarus/_config.yml lang:yaml %} comment: type: gitment owner: you_github_name repo: Some-of-Your-GitHub-Repo client_id: xxxxxxxxxxxxxxxxxxxx client_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx theme: gitment.defaultTheme # 可选填 per_page: 20 # 可选填 max_comment_height: 250 # 可选填 {% endcodeblock %}
-
关于上述配置的含义和可选值,请参考Gitment官方文档或hexo-component-inferno 中的配置项描述。
Isso
如果你不希望以来第三方评论服务而自建评论系统的话,可考虑选用Isso。 当然,不同于第三方评论系统,你需要准备一个服务器用来运行Isso服务端程序。
安装指南
-
请参照Isso官方文档安装并启动Isso服务。
-
编辑主题配置文件并填入Isso服务的HTTP URL。例如,你的Isso服务地址为https://posativ.org/isso/api/, 则需在主题评论配置填写为:
{% codeblock themes/icarus/_config.yml lang:yaml %} comment: type: isso url: posativ.org/isso/api {% endcodeblock %}
LiveRe
-
首先,注册并登录LiveRe。登录后,点击导航栏上的“安装”(Install)链接,进入安装界面。
-
在安装界面选择免费(City)选项下方的“现在安装”(Install Now)按钮。在获取LiveRe City代码(Get LiveRe City code)界面 填入站点地址(Site URL),网站名称(Name of website),和网站类别(Choose site category),勾选“同意广告协议后”并点击 获取代码后,跳转到LiveRe代码页面。
-
复制代码中
data-uid="..."
引号内的编号,填写到主题配置中的相应选项中。例如,下方的LiveRe代码{% asset_img livere-code.png "LiveRe - Install" %}
对应的主题配置为
{% codeblock themes/icarus/_config.yml lang:yaml %} comment: type: livere uid: ABCD1234O0OxxxxXXXX000== {% endcodeblock %}
Utterances
-
准备一个公开的GitHub仓库(Repository)。
-
访问GitHub Apps - utterances页面来将utterances安装至准备好的仓库。 点击“配置”(Configure)按钮,在下一页面中选择需要安装utterances的用户。在安装页面,你可以选择将其安装到所有仓库(All repositories) 或是选定的一些仓库(Only select repositories)。点击“安装”(Install)。
-
若安装成功,网页跳转到utterances官网后。之后可以阅读页面上的配置项的说明,并按照说明将对应配置值填入到 主题配置中。下方为示例配置:
{% codeblock themes/icarus/_config.yml lang:yaml %} comment: type: utterances repo: Your-GitHub-Username/Your-Public-Repo-Name issue_term: pathname # 必填项,与issue_number二选一填写 issue_number: 100 # 必填项,与issue_term二选一填写,每篇文章对应一个issue,填写前需要手动创建issue label: some-issue-label # 可选填 theme: github-light # 可选填 {% endcodeblock %}
Valine
-
按照Valine官方的快速开始文档创建LeanCloud应用。
-
将App ID和App Key复制并填入主题配置的对应配置项中,并按照官方网站上的配置项 说明按需填写其他配置项。下面是示例配置:
{% codeblock themes/icarus/_config.yml lang:yaml %} comment: type: valine app_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx app_key: xxxxxxxxxxxxxxxxxxxxxx placeholder: "" # 可选填 notify: false # 可选填 verify: false # 可选填 avatar: # 可选填 avatar_force: false # 可选填 meta: ["nick", "mail", "link"] # 可选填 page_size: 10 # 可选填 visitor: false # 可选填 highlight: true # 可选填 record_ip: false # 可选填 {% endcodeblock %}