MOxFIVE / hexo-theme-yelee

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

is_page() error when generate 生成文件时 is_page() 报错 #26

Closed SyncShinee closed 8 years ago

SyncShinee commented 8 years ago

您好,在使用您的主题进行generate时,报错:

Welcome to Git (version 1.9.5-preview20141217)

Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.

skyxuan@SKYXUAN_PC /D/Hexo
$ hexo g
[info] Files loaded in 1.154s
[create] Generated: archives/index.html (90ms)
[create] Generated: archives/page/2/index.html (57ms)
[create] Generated: archives/page/3/index.html (36ms)
[create] Generated: archives/2014/index.html (26ms)
[create] Generated: archives/2014/07/index.html (19ms)
[create] Generated: archives/2014/08/index.html (18ms)
[create] Generated: archives/2015/index.html (37ms)
[create] Generated: archives/2015/page/2/index.html (25ms)
[create] Generated: archives/2015/01/index.html (19ms)
[create] Generated: archives/2015/04/index.html (21ms)
[create] Generated: archives/2015/05/index.html (22ms)
[create] Generated: archives/2015/07/index.html (22ms)
[create] Generated: archives/2016/index.html (29ms)
[create] Generated: archives/2016/01/index.html (25ms)
[create] Generated: categories/android/index.html (17ms)
[create] Generated: index.html (35ms)
[create] Generated: page/2/index.html (44ms)
[create] Generated: page/3/index.html (19ms)
[error] HexoError: Render failed: about/index.html
ReferenceError: d:\Hexo\themes\yelee\layout\page.ejs:1
 >> 1| <%- partial('_partial/article', {post: page, index: false}) %>

d:\Hexo\themes\yelee\layout\_partial\article.ejs:31
    29|           <% } %>
    30|       <% } else { %>
 >> 31|           <% if (is_page()){ %>
    32|               <%- partial('_partial/page') %>
    33|           <% } %>
    34|         <%- post.content %>

is_page is not defined
    at eval (eval at <anonymous> (d:\Hexo\node_modules\hexo-renderer-ejs\node_mo
dules\ejs\lib\ejs.js:242:14), <anonymous>:29:1761)
    at eval (eval at <anonymous> (d:\Hexo\node_modules\hexo-renderer-ejs\node_mo
dules\ejs\lib\ejs.js:242:14), <anonymous>:37:454)
    at d:\Hexo\node_modules\hexo-renderer-ejs\node_modules\ejs\lib\ejs.js:255:15

    at Object.exports.render (d:\Hexo\node_modules\hexo-renderer-ejs\node_module
s\ejs\lib\ejs.js:293:13)
    at d:\Hexo\node_modules\hexo-renderer-ejs\index.js:5:14
    at Object.exports.renderSync (c:\Users\skyxuan\AppData\Roaming\npm\node_modu
les\hexo\lib\core\render.js:133:12)
    at View.renderSync (c:\Users\skyxuan\AppData\Roaming\npm\node_modules\hexo\l
ib\theme\view.js:183:28)
    at partial (c:\Users\skyxuan\AppData\Roaming\npm\node_modules\hexo\lib\plugi
ns\helper\partial.js:29:17)
    at Object.module.exports (c:\Users\skyxuan\AppData\Roaming\npm\node_modules\
hexo\lib\plugins\helper\partial.js:37:12)
    at eval (eval at <anonymous> (d:\Hexo\node_modules\hexo-renderer-ejs\node_mo
dules\ejs\lib\ejs.js:242:14), <anonymous>:29:35)

skyxuan@SKYXUAN_PC /D/Hexo
$

之前使用其他主题时没遇到过这个问题。我是在windows环境下搭建的hexo博客,是我的依赖不全导致的吗?

SyncShinee commented 8 years ago

问题已解决,是我的hexo版本太老导致的,我update了一下就没问题了。 谢谢您提供的这个主题~~

MOxFIVE commented 8 years ago

更新 Hexo 到最新版本。 我部分模块使用了 is_page() 这个辅助函数,低于 3.1.1 的 Hexo 版本可能不支持导致出错。

Update your Hexo to lastest version ( >= 3.1.1 ) to use is_page() helper and fix generating issue.