1.下载 yilia

1
2
3
4
5
cd /opt/blog/themes

git clone https://github.com/litten/hexo-theme-yilia

mv hexo-theme-yilia yilia

2.修改 theme 为 yilia

进入 hexo 根目录
UTOOLS1576650837952.jpeg
vi _config.yml

1
2
3
4
5
73 # Extensions
74 ## Plugins: https://hexo.io/plugins/
75 ## Themes: https://hexo.io/themes/
76 #theme: landscape
77 theme: yilia

3.修改头像

进入 yilia 目录

1
2
3
4
5
6
mac126deMacBook-Air:yilia macwz$ pwd
/opt/blog/themes/yilia
mac126deMacBook-Air:yilia macwz$ ls
README.md layout source-src
_config.yml package.json webpack.config.js
languages source

vi _config.yml

1
2
70 #你的头像url
71 avatar: https://wangwenzhe.oss-cn-beijing.aliyuncs.com/UTOOLS1576650841337.jpeg

4.友情链接、关于我

yilia 目录 _config.yml 「同上」

1
2
3
4
5
6
7
8
friends:
程序员导航: http://code.giffox.com/
阮一峰: http://www.ruanyifeng.com/home.html
廖雪峰: https://www.liaoxuefeng.com/
虫部落搜索: https://search.chongbuluo.com/
精选书单 Love2: https://love2.io/

aboutme: 技术控、产品控、不完美的完美主义者。

5.左侧显示总文章数、总字数

修改 themes/yilia/layout/_partial/left-col.ejs

1
2
3
4
5
6
7
8
<nav class="header-nav">
<div class="social">
<% for (var i in theme.subnav){ %>
<a class="<%= i %>" target="_blank" href="<%- url_for(theme.subnav[i]) %>"
title="<%= i %>"><i class="icon-<%= i %>"></i></a>
<%}%>
</div>
</nav>

//同级下面新增

1
2
3
4
<nav style="margin-top: 80px; font-size: 13px; color: #4d4d4d;">
<p>总文章数 <%=site.posts.length%></p>
<p>总字数 <span class="post-count"><%= totalcount(site, '0,0.0a') %></span></p>
</nav>

6.文章字数统计和阅读时长

  1. 安装插件
    1
    npm i --save hexo-wordcount
  2. 编辑 themes/yilia/layout/_partial/article.ejs, 在header下面加入
    1
    2
    3
    4
    5
    6
    7
    8
    9
    <header class="article-header">
    <%- partial('post/title', {class_name: 'article-title'}) %>
    <% if (!post.noDate){ %>
    <%- partial('post/date', {class_name: 'archive-article-date', date_format: null}) %>
    <% } %>
    </header>
    <div align="center" style="font-size: 12px; color: #1a5f14;">
    字数:<%= wordcount(post.content) %>字 | 阅读本文大概需要 :<%= min2read(post.content) %>分钟
    </div>
  1. 去掉代码块中行号

    UTOOLS1576650843518.jpeg
    UTOOLS1576650845474.jpeg