tangkunyin/hexo-theme-jsimple

heox generate met with error

Closed this issue · 4 comments

#5
i love your theme but i face a little problem using it
i do

hexo init test
cd ./test
npm install

and i change theme in _config.yml
and when calling hexo g i encountered with following error

Unhandled rejection TypeError: C:\Users\77936\git\test\themes\jsimple\layout\post.ejs:1
 >> 1| <%- partial('_partial/_post', {post: page, index: false}) %>

C:\Users\77936\git\test\themes\jsimple\layout\_partial\_post.ejs:5
    3|         <li><a href="/">最新</a></li>
    4|         <% for (var i in theme.menu){ %>
 >> 5|         <li class="<%= (page.categories.first().name == i) ? 'active' : '' %>">
    6|             <a href="/categories/<%= theme.menu[i] %>" data-name="<%= i %>"><%= i %></a>
    7|         </li>
    8|         <% } %>

Cannot read property 'name' of undefined
    at eval (eval at <anonymous> (C:\Users\77936\git\test\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:228)
    at eval (eval at <anonymous> (C:\Users\77936\git\test\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:670)
    at C:\Users\77936\git\test\node_modules\ejs\lib\ejs.js:255:15
    at _compiledSync (C:\Users\77936\git\test\node_modules\hexo\lib\theme\view.js:122:20)
    at View.renderSync (C:\Users\77936\git\test\node_modules\hexo\lib\theme\view.js:50:21)
    at Object.partial (C:\Users\77936\git\test\node_modules\hexo\lib\plugins\helper\partial.js:42:17)
    at Object.wrapper (C:\Users\77936\git\test\node_modules\lodash\lodash.js:4968:19)
    at eval (eval at <anonymous> (C:\Users\77936\git\test\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:35)
    at eval (eval at <anonymous> (C:\Users\77936\git\test\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:99)
    at C:\Users\77936\git\test\node_modules\ejs\lib\ejs.js:255:15
    at _compiled (C:\Users\77936\git\test\node_modules\hexo\lib\theme\view.js:127:30)
    at View.render (C:\Users\77936\git\test\node_modules\hexo\lib\theme\view.js:29:15)
    at C:\Users\77936\git\test\node_modules\hexo\lib\hexo\index.js:387:25
    at tryCatcher (C:\Users\77936\git\test\node_modules\bluebird\js\release\util.js:16:23)
    at C:\Users\77936\git\test\node_modules\bluebird\js\release\method.js:15:34
    at RouteStream._read (C:\Users\77936\git\test\node_modules\hexo\lib\hexo\router.js:134:3)
    at RouteStream.Readable.read (_stream_readable.js:348:10)
    at resume_ (_stream_readable.js:737:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

i'm on windows using ,have i do anything wrong?

hexo: 3.2.2
hexo-cli: 1.0.2
os: Windows_NT 10.0.14393 win32 x64
http_parser: 2.7.0
node: 6.10.0
v8: 5.1.281.93
uv: 1.9.1
zlib: 1.2.8
ares: 1.10.1-DEV
icu: 58.2
modules: 48
openssl: 1.0.2k

看了看demo博客意识到没必要用英文。。
主要是hexo g 后启动hexo server 在localhost里面看到的内容没有css。。
我不是很懂前端,,,我在想这是不是和上面的报错有点关系..
我只执行了上面几个命令...也不知道哪里错了..求教..十分感谢

仔细看了一下,好像是浏览器相关问题。。
chrome 里面请求相关css时network header显示:Provisional headers are shown
edge就没问题

@jojo23333 你好,首先看看主题配置中的fullHttps ,因为你在本地localhost,这个选项用于强制全站https,如果此项为true,本地是无法加载样式的。

其二,网站配置中,需要指定分类或标签别名,这样就算url有中文,也能很好的显示,不至于文章url一团乱

感谢!我大概明白了