Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

post.categories.map is not a function #290

Open
CrazyGriferman opened this issue Oct 5, 2020 · 2 comments
Open

post.categories.map is not a function #290

CrazyGriferman opened this issue Oct 5, 2020 · 2 comments

Comments

@CrazyGriferman
Copy link

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
Copy link
Author

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 (stream_readable.js:457:10)
at resume
(_stream_readable.js:933:12)
at process._tickCallback (internal/process/next_tick.js:63:19)

@ppoffice
Copy link
Owner

ppoffice commented Oct 5, 2020

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants