| 
yilia主題作者已經(jīng)不維護(hù)了,還有好多坑沒有填完,在此記錄一下 主題地址:https://github.com/litten/hexo-theme-yilia 主題下載并啟用進(jìn)入命令行,下載yilia主題,輸入: git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia
 修改站點(diǎn)配置文件 _config.yml,找到如下代碼: ## Themes: https:///themes/
theme: landscape
 將 landscape修改為yilia即可。 修改語言打開站點(diǎn)配置文件,搜索language,找到如下代碼: author:
language:
timezone:
 在language后面輸入zh-CN。 注意:冒號后面必須有一個(gè)空格。 “所有文章”按鈕的安裝首先使用命令 node -v檢查版本是不是大于6.2 在博客根目錄執(zhí)行以下命令: npm i hexo-generator-json-content --save
 在博客配置文件 _config.yml最下面加上: jsonContent:
meta: false
pages: false
posts:
title: true
date: true
path: true
text: false
raw: false
content: false
slug: false
updated: false
comments: false
link: false
permalink: false
excerpt: false
categories: false
tags: true
 添加圖片資源文件夾路徑為 themes/yilia/source/下,可添加一個(gè)assets文件夾,里面存放圖片資源即可 需要添加頭像或者微信/支付寶二維碼圖片,直接引用即可。路徑為 themes/yilia/_config.yml。 # 微信二維碼圖片
weixin: /assets/img/wechat.png
# 頭像圖片
avatar: /assets/img/head.jpg
# 網(wǎng)頁圖標(biāo)
favicon: /assets/img/head.jpg
 文章顯示摘要在你 MD 格式文章正文插入 <!-- more -->即可,只會顯示它之前的,此后的就不顯示,點(diǎn)擊文章標(biāo)題,全文閱讀才可看到,同時(shí)注釋掉文件themes/yilia/_config.yml里的: # excerpt_link: more
 文章顯示目錄增加文章目錄 TOC ( table of content ),方便閱讀文章, 在 themes/yilia/_config.ym中進(jìn)行配置toc: 2即可,它會將你 Markdown 語法的標(biāo)題,生成目錄,目錄查看在右下角。 增加歸檔菜單修改 themes/yilia/_config.yml內(nèi)容: menu:
主頁: /
歸檔: /archives/index.html
 修復(fù)失效的微信分享二維碼打開themes\yilia\layout\_partial\post\share.ejs文件把第49行中的
 //pan.baidu.com/share/qrcode?url=修改為: //api.qrserver.com/v1/create-qr-code/?size=150x150&data=
 更改左側(cè)昵稱字體在 themes\yilia\source\main.0cf68a.css文件里面修改,找到header-author,修改里面的font-family,改成: font-family:"Times New Roman",Georgia,Serif
 左側(cè)顯示總文章數(shù)打開 themes\yilia\layout_partial\left-col.ejs文件 在: <nav class="header-menu">
<ul>
<% for (var i in theme.menu){ %>
<li><a href="<%- url_for(theme.menu[i]) %>"><%= i %></a></li>
<%}%>
</ul>
</nav>
 后面添加: <nav>
總文章數(shù) <%=site.posts.length%>
</nav>
 添加字?jǐn)?shù)統(tǒng)計(jì)首先安裝 hexo-wordcount 使用如下命令安裝: npm i --save hexo-wordcount
 
Node 版本7.6.0之前,請安裝 2.x 版本 (Node.js v7.6.0 and previous) npm install hexo-wordcount@2 --save
 然后在 themes\yilia\layout\_partial\left-col.ejs中添加: 總字?jǐn)?shù) <span class="post-count"><%= totalcount(site, '0,0.0a') %></span>
 編輯 themes\yilia\layout_partial\article.ejs 在header下面加入: <div align="center" class="post-count">
字?jǐn)?shù):<%= wordcount(post.content) %>字 | 預(yù)計(jì)閱讀時(shí)長:<%= min2read(post.content) %>分鐘
</div>
 即可顯示單篇字?jǐn)?shù)和預(yù)計(jì)閱讀時(shí)長。 添加來必力(livere)評論系統(tǒng)yilia默認(rèn)帶了幾個(gè)系統(tǒng),但是沒有來必力,所以可以自己加首先是去注冊來必力,然后獲取到自己的
 id 新建 themes\yilia\layout\_partial\comment\livere.ejs文件,輸入如下內(nèi)容: <!-- 來必力City版安裝代碼 -->
<div id="lv-container" data-id="city" data-uid="<%=theme.livere_uid%>">
<script type="text/javascript">
(function(d, s) {
var j, e = d.getElementsByTagName(s)[0];
if (typeof LivereTower === 'function') { return; }
j = d.createElement(s);
j.src = 'https://cdn-city./js/embed.dist.js';
j.async = true;
e.parentNode.insertBefore(j, e);
})(document, 'script');
</script>
<noscript>為正常使用來必力評論功能請激活JavaScript</noscript>
</div>
<!-- City版安裝代碼已完成 -->
 然后編輯 themes\yilia\layout\_partial\article.ejs文件,找到:<% if (!index && post.comments){ %>,添加: <% if (theme.livere){ %>
<%- partial('comment/livere', {
key: post.slug,
title: post.title,
url: config.url url_for(post.path)
}) %>
<% } %>
 在主題配置文件 themes\yilia\_config.yml中添加以下內(nèi)容: livere: true
livere_uid: 你的id
 關(guān)閉信息收集(可選)關(guān)于訪問 來源:https://www./content-4-339101.htmllitten.me:9005的問題,這個(gè)主題的作者之前為了更好地完善這個(gè)主題,有時(shí)候會收集用戶的客戶端信息,詳情請見https://github.com/litten/hexo-theme-yilia/issues/528 ,如果不想被統(tǒng)計(jì),就將themes\yilia\source-src\js\report.js里面的內(nèi)容清空。不過這個(gè)請求是異步的,不會影響博客加載速度,而且作者已經(jīng)不維護(hù)了,所以關(guān)不關(guān)都行。 |