文章目录
  1. 1. 添加“多说”评论
    1. 1.1. 获取通用代码
    2. 1.2. 添加页面导航
    3. 1.3. 添加JiaThis分享

添加“多说”评论


获取通用代码

  1. 先在多说进行安装
  2. _config.yml中添加多说配置:
1
duoshao_shortname: 你站点的short_name
  1. 将通用代码复制到$THEME/layout/_partial/comment.ejs中,

1
2
3
4
5
<% if ( page.comments){ %>
<section id="comment">
通用代码
</section>
<% } %>

添加页面导航

对刚刚的文件,也就是$THEME/layout/_partial/comment.ejs中,加入代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<% if ( page.comments){ %>

<!--刚刚复制的代码-->

<nav id="pagination" >
<% if (page.prev) { %>
<a href="<%- config.root %><%- page.prev.path %>" class="alignleft prev" ><%= __('prev') %></a>
<% } %>
<% if (page.next) { %>
<a href="<%- config.root %><%- page.next.path %>" class="alignright next" ><%= __('next') %></a>
<% } %>
<div class="clearfix"></div>
</nav>

<section id="comment">

将ID、标题和网址进行修改,分别

  • ID 用<%- item.path %>替换
  • 标题 用<%= item.title %>替换
  • 网址 用<%- config.url %><%- config.root%><%- item.path %> 替换

添加JiaThis分享

  1. $THEME/layout/_partial/post下创建jiathis.ejs文件
  2. 将下面的代码复制进去:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<% if (theme.jiathis.enable){ %>
<div class="jiathis_style">
<span class="jiathis_txt">分享到:</span>
<a class="jiathis_button_tsina">新浪微博</a>
<a class="jiathis_button_weixin">微信</a>
<a class="jiathis_button_renren">人人</a>
<a class="jiathis_button_evernote">EverNote</a>
<a href="http://www.jiathis.com/share?uid=1501277" class="jiathis jiathis_txt jiathis_separator jtico jtico_jiathis" target="_blank">更多</a>
</div>
<script type="text/javascript" >
var jiathis_config={
data_track_clickback:true,
sm:"copy,renren,cqq",
pic:"<%- item.photos %>",
summary:"",
<% if (theme.jiathis.tsina){ %> ralateuid:{"tsina":"<%= theme.jiathis.tsina %>"},hideMore:false}
<% } %>
</script>
<script type="text/javascript" src="//v3.jiathis.com/code/jia.js?uid=
<% if (theme.jiathis.id){ %><%= theme.jiathis.id %><% } %>" charset="utf-8"></script>
<% } %>
文章目录
  1. 1. 添加“多说”评论
    1. 1.1. 获取通用代码
    2. 1.2. 添加页面导航
    3. 1.3. 添加JiaThis分享