1. post.excerpt摘要沒有顯示出來
需要在文章裏面添加
<!-- more -->
該註釋標籤上面的內容即爲摘要
2. post.excerpt摘要沒有按html解析,按文本解析
使用的時候寫成
<%= post.excerpt %>
不該寫成<%=,應該寫成<%-
<%- post.excerpt %>
3. hexo deploy發生錯誤
執行hexo deploy出現報錯
ERROR Deployer not found: git
執行
npm install --save hexo-deployer-git
再執行
hexo deploy就不會了
4. 使用site.posts[0]時出錯
我在使用site.posts時,使用forEach的語法的時候,可以遍歷文章內容,但是通過索引(site.posts[0])獲取文章內容的時候就失敗了,而打印site.posts.length是有值的
把site.posts打印出來才發現,site.posts的結構是這樣的。。。
{
data:[
// ...實際的文章內容
],
length:n, // n爲文章的數量
// ...
}
所以就改用site.posts.data[0]了
5. hexo部署時發生錯誤Unhandled rejection Nunjucks Error:
是md文件裏面某個出錯了,可能要具體去排查
我這裏出現的問題是寫了
{{}}
只要在第一個{前面加上反斜槓\即可
(ps:我自己已經搭建了一個主題可以使用,在github上有相關的使用指南,喜歡或者能夠從中有所收穫就幫忙點個star吧~,這也是我主題繼續更新動力)