搭建步骤
详细步骤请参考: Writing
注意事项
1.部署到Github前需要配置hexo文件下的_config.yml文件。1
2
3
4
5
6# Deployment
## Docs: http://hexo.io/docs/deployment.html
deploy: //*注意deploy下面的文字都要缩进两个空格,每个冒号后面都要有一个空格,每句结尾也要有一个空格*
type: git
repo: git@github.com:guaputao/guaputao.github.io.git
branch: master
2.新版的hexo在部署的时候,需要提前安装以下插件1
$ npm install hexo-deployer-git --save
3.Yilia主题下添加多说评论插件
首先去多说官网申请一个多说项目
其次需要在Yilia主题文件下的config.yml文件中添加duoshuo_shortname: guaputao,其中”guaputao”为多说中基本设置的名称
随后在\hexo\themes\yilia\layout_partial目录下的article.ejs文件中加入如下代码(要删除文件中还有评论的代码,才能加入这段代码,否则会出现多个评论框):1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20<% if (!index && post.comments && theme.duoshuo_shortname){ %>
<section id="comments">
<!-- 多说评论框 start -->
<div class="ds-thread" data-thread-key="<%= post.layout %>-<%= post.slug %>" data-title="<%= post.title %>" data-url="<%= page.permalink %>"></div>
<!-- 多说评论框 end -->
<!-- 多说公共JS代码 start (一个网页只需插入一次) -->
<script type="text/javascript">
var duoshuoQuery = {short_name:'<%= theme.duoshuo_shortname %>'};
(function() {
var ds = document.createElement('script');
ds.type = 'text/javascript';ds.async = true;
ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
ds.charset = 'UTF-8';
(document.getElementsByTagName('head')[0]
|| document.getElementsByTagName('body')[0]).appendChild(ds);
})();
</script>
<!-- 多说公共JS代码 end -->
</section>
<% } %>