ppoffice / hexo-theme-hueman

A redesign of Alx's wordpress theme Hueman, ported to Hexo.
http://ppoffice.github.io/hexo-theme-hueman/
GNU General Public License v2.0
1.17k stars 336 forks source link

post.categories.map is not a function #290

Open CrazyGriferman opened 3 years ago

CrazyGriferman commented 3 years ago

ERROR /Users/zhaoqi/blog/themes/hueman/layout/page.ejs:1

1| <%- partial('common/article', { post: page }) %>

/Users/zhaoqi/blog/themes/hueman/layout/common/article.ejs:28 26| 27|

28| <%- partial('post/ld_json', { post: post }) %> 29| 30| <%- partial('comment/index') %> 31|

/Users/zhaoqi/blog/themes/hueman/layout/common/post/ld_json.ejs:12 10| "image": "<%- url_for(config.url + thumbnail(post)) %>", 11| <% if (post.tags) { %>"keywords": "<%- post.tags.map(t => t.name).join(' ') %>",<% } %>

12| <% if (post.categories) { %>"genre": "<%- post.categories.map(c => c.name).join(' ') %>",<% } %> 13| "datePublished": "<%- date(post.date, 'YYYY-MM-DD') %>", 14| "dateCreated": "<%- date(post.date, 'YYYY-MM-DD') %>", 15| <% if (post.updated) { %>"dateModified": "<%- date(post.updated, 'YYYY-MM-DD') %>",<% } %>

post.categories.map is not a function

Did anyone meet this problem? It doesn't affect the site but it's annoying.

CrazyGriferman commented 3 years ago

TypeError: /Users/zhaoqi/blog/themes/hueman/layout/page.ejs:1

1| <%- partial('common/article', { post: page }) %>

/Users/zhaoqi/blog/themes/hueman/layout/common/article.ejs:28 26| 27|

28| <%- partial('post/ld_json', { post: post }) %> 29| 30| <%- partial('comment/index') %> 31|

/Users/zhaoqi/blog/themes/hueman/layout/common/post/ld_json.ejs:12 10| "image": "<%- url_for(config.url + thumbnail(post)) %>", 11| <% if (post.tags) { %>"keywords": "<%- post.tags.map(t => t.name).join(' ') %>",<% } %>

12| <% if (post.categories) { %>"genre": "<%- post.categories.map(c => c.name).join(' ') %>",<% } %> 13| "datePublished": "<%- date(post.date, 'YYYY-MM-DD') %>", 14| "dateCreated": "<%- date(post.date, 'YYYY-MM-DD') %>", 15| <% if (post.updated) { %>"dateModified": "<%- date(post.updated, 'YYYY-MM-DD') %>",<% } %>

post.categories.map is not a function at eval (eval at compile (/Users/zhaoqi/blog/node_modules/ejs/lib/ejs.js:618:12), :33:33) at returnedFn (/Users/zhaoqi/blog/node_modules/ejs/lib/ejs.js:653:17) at Theme._View.View._compiledSync.locals [as _compiledSync] (/Users/zhaoqi/blog/node_modules/hexo/lib/theme/view.js:121:22) at Theme._View.View.View.renderSync (/Users/zhaoqi/blog/node_modules/hexo/lib/theme/view.js:49:23) at Object.partial (/Users/zhaoqi/blog/node_modules/hexo/lib/plugins/helper/partial.js:38:15) at eval (eval at compile (/Users/zhaoqi/blog/node_modules/ejs/lib/ejs.js:618:12), :66:17) at returnedFn (/Users/zhaoqi/blog/node_modules/ejs/lib/ejs.js:653:17) at Theme._View.View._compiledSync.locals [as _compiledSync] (/Users/zhaoqi/blog/node_modules/hexo/lib/theme/view.js:121:22) at Theme._View.View.View.renderSync (/Users/zhaoqi/blog/node_modules/hexo/lib/theme/view.js:49:23) at Object.partial (/Users/zhaoqi/blog/node_modules/hexo/lib/plugins/helper/partial.js:38:15) at eval (eval at compile (/Users/zhaoqi/blog/node_modules/ejs/lib/ejs.js:618:12), :9:17) at returnedFn (/Users/zhaoqi/blog/node_modules/ejs/lib/ejs.js:653:17) at Theme._View.View._compiled.locals [as _compiled] (/Users/zhaoqi/blog/node_modules/hexo/lib/theme/view.js:125:48) at Theme._View.View.View.render (/Users/zhaoqi/blog/node_modules/hexo/lib/theme/view.js:30:15) at route.set (/Users/zhaoqi/blog/node_modules/hexo/lib/hexo/index.js:394:29) at tryCatcher (/Users/zhaoqi/blog/node_modules/bluebird/js/release/util.js:16:23) at /Users/zhaoqi/blog/node_modules/bluebird/js/release/method.js:15:34 at RouteStream._read (/Users/zhaoqi/blog/node_modules/hexo/lib/hexo/router.js:134:3) at RouteStream.Readable.read (_streamreadable.js:457:10) at resume (_stream_readable.js:933:12) at process._tickCallback (internal/process/next_tick.js:63:19)

ppoffice commented 3 years ago

@CrazyGriferman What's the front-matter of your post markdown file?