MOxFIVE / hexo-theme-yelee

简而不减 Hexo 双栏博客主题; Another simple and elegant theme for Hexo.
http://moxfive.xyz/
1.38k stars 328 forks source link

在非默認目錄(_posts)的文章設置分類報錯 #29

Closed ShinoharaYuri closed 8 years ago

ShinoharaYuri commented 8 years ago

因為我的blog有收集一些新聞給朋友用… 今天試了一下只留了一個主文章在_posts資料夾, 把分開的咨詢放到其他資料夾(這樣測試就不顯示在主頁了) 但是加分類的時候報錯…… 標籤沒有報錯但是發現無法在標籤頁顯示

請問這個是?

Unhandled rejection TypeError: /home/pi/blog/themes/yelee/layout/page.ejs:1
 >> 1| <%- partial('_partial/article', {post: page, index: false}) %>

/home/pi/blog/themes/yelee/layout/_partial/article.ejs:17
15|       <% if (!index){ %>
16|       <div class="article-info article-info-post">
 >> 17|         <%- partial('post/category') %>
18|         <%- partial('post/tag') %>
19|         <div class="clearfix"></div>
20|       </div>

/home/pi/blog/themes/yelee/layout/_partial   /post/category.ejs:3
1| <% if (post.categories && post.categories.length){ %>
2|     <div class="article-category tagcloud">
>> 3|     <%- list_categories(post.categories, {
4|       show_count: false,
5|       class: 'article-category',
6|       style: 'none',

#<Object> is not a function
at Array.find (native)
at prepareQuery (/home/pi/blog/node_modules/hexo/lib/plugins/helper/list_categories.js:35:23)
at flatList (/home/pi/blog/node_modules/hexo/lib/plugins/helper/list_categories.js:95:5)
at Object.listCategoriesHelper (/home/pi/blog/node_modules/hexo/lib/plugins/helper/list_categories.js:118:15)
at eval (eval at <anonymous> (/home/pi/blog/node_modules/ejs/lib/ejs.js:242:14), <anonymous>:30:167)
at eval (eval at <anonymous> (/home/pi/blog/node_modules/ejs/lib/ejs.js:242:14), <anonymous>:35:70)
at /home/pi/blog/node_modules/ejs/lib/ejs.js:255:15
at Object.exports.render (/home/pi/blog/node_modules/ejs/lib/ejs.js:293:13)
at Hexo.ejsRenderer (/home/pi/blog/node_modules/hexo-renderer-ejs/lib/renderer.js:7:14)
at Render.renderSync (/home/pi/blog/node_modules/hexo/lib/hexo/render.js:87:23)
at View.renderSync (/home/pi/blog/node_modules/hexo/lib/theme/view.js:50:29)
at Object.partial (/home/pi/blog/node_modules/hexo/lib/plugins/helper/partial.js:42:19)
at eval (eval at <anonymous> (/home/pi/blog/node_modules/ejs/lib/ejs.js:242:14), <anonymous>:30:1013)
at eval (eval at <anonymous> (/home/pi/blog/node_modules/ejs/lib/ejs.js:242:14), <anonymous>:38:454)
at /home/pi/blog/node_modules/ejs/lib/ejs.js:255:15
at Object.exports.render (/home/pi/blog/node_modules/ejs/lib/ejs.js:293:13)
at Hexo.ejsRenderer (/home/pi/blog/node_modules/hexo-renderer-ejs/lib/renderer.js:7:14)
at Render.renderSync (/home/pi/blog/node_modules/hexo/lib/hexo/render.js:87:23)
at View.renderSync (/home/pi/blog/node_modules/hexo/lib/theme/view.js:50:29)
at Object.partial (/home/pi/blog/node_modules/hexo/lib/plugins/helper/partial.js:42:19)
at eval (eval at <anonymous> (/home/pi/blog/node_modules/ejs/lib/ejs.js:242:14), <anonymous>:30:35)
at eval (eval at <anonymous> (/home/pi/blog/node_modules/ejs/lib/ejs.js:242:14), <anonymous>:30:101)
at /home/pi/blog/node_modules/ejs/lib/ejs.js:255:15
at Object.exports.render (/home/pi/blog/node_modules/ejs/lib/ejs.js:293:13)
at Hexo.ejsRenderer (/home/pi/blog/node_modules/hexo-renderer-ejs/lib/renderer.js:7:14)
at Hexo.tryCatcher (/home/pi/blog/node_modules/bluebird/js/main/util.js:26:23)
at Hexo.<anonymous> (/home/pi/blog/node_modules/bluebird/js/main/method.js:15:34)
at /home/pi/blog/node_modules/hexo/lib/hexo/render.js:51:21
at tryCatcher (/home/pi/blog/node_modules/bluebird/js/main/util.js:26:23)
at Promise._settlePromiseFromHandler (/home/pi/blog/node_modules/bluebird/js/main/promise.js:507:31)
at Promise._settlePromiseAt (/home/pi/blog/node_modules/bluebird/js/main/promise.js:581:18)
at Promise._settlePromiseAtPostResolution (/home/pi/blog/node_modules/bluebird/js/main/promise.js:245:10)
at Async._drainQueue (/home/pi/blog/node_modules/bluebird/js/main/async.js:128:12)
at Async._drainQueues (/home/pi/blog/node_modules/bluebird/js/main/async.js:133:10)
at Immediate.Async.drainQueues [as _onImmediate] (/home/pi/blog/node_modules/bluebird/js/main/async.js:15:14)
at processImmediate [as _immediateCallback] (timers.js:383:17)
MOxFIVE commented 8 years ago

文章需要直接放在 _posts 資料夾下。放再其他資料夾的話會被當成 page (頁面) 處理,並且不會在主頁和文章列表中顯示。同時只有 post (文章) 才支援分類和標籤 https://hexo.io/zh-tw/docs/front-matter.html#u5206_u985E_u548C_u6A19_u7C64

ShinoharaYuri commented 8 years ago

知道了 感謝回答