网上很多为hexo next主题添加版权说明的文章,但是几乎没找到怎么为icarus主题设置版权说明的文章,可见还是Next主题多啊。
下面介绍如何为icarus主题添加版权说明。
Icarus添加版权说明
- 修改blog目录下”/themes/icarus/_config.yml” 这个文件,在文件最后添加版权说明配置,如下:
1 2 3 4 5 6 7
| #版权信息 copyright: enable: true # img: http://ostu98x74.bkt.clouddn.com/copyright/copyright.png #版权信息图片 site: http://www.inicb.com #版权信息所属网址 siteName: Ini's Blog #版权信息网站名字 siteAuthor: '王建磊' #版权归属人
|
- 修改icarus主题下的layout/common/article.ejs文件,修改如下部分
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| <% if (!index) { %> <%- partial('post/nav') %> <% } %>
# 改为如下
<% if (!index) { %> <div> <ul class="post-copyright"> <li class="post-copyright-author"> <strong>本文作者:</strong><%= theme.copyright.siteAuthor%></a> </li> <li class="post-copyright-link"> <strong>本文链接:</strong> <a href="" title="{{ page.title }}"><%= post.title %></a> </li> <li class="post-copyright-link"> <strong>发布时间:</strong> <a href="" title="{{ page.title }}"><%= post.date.format("YYYY年M月D日 - HH时MM分") %></a> </li> <li class="post-copyright-license"> <strong>版权声明: </strong> 本博客所有文章除特别声明外,均采用 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/cn/" rel="external nofollow" target="_blank">CC BY-NC-SA 3.0 CN</a> 许可协议。转载请注明出处! </li> </ul> <div> <%- partial('post/nav') %> <% } %>
|
- 为版权说明添加样式
修改themes/icarus/source/css/_partial/article.styl 文件,在文件末尾添加如下样式。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| // Custom styles. //版权声明 .post-copyright { margin: 2em 0 0; padding: 0.5em 1em; border-left: 3px solid #FF1700; background-color: #F9F9F9; list-style: none; }
.post-copyright li { //设置行高 line-height: 30px; }
|
至此,完成了为icarus添加版权声明的功能。
参考资料