Cannot read properties of undefined (reading 'forEach') at Object.pug_interp [as articleSort] (eval at wrap (C:\MyCode\Projects\my-blog\node_modules\pug-runtime\wrap.js:6:10), <anonymous>:1749:7) at eval (eval at wrap (C:\MyCode\Projects\my-blog\node_modules\pug-runtime\wrap.js:6:10), <anonymous>:1809:26) at template (eval at wrap (C:\MyCode\Projects\my-blog\node_modules\pug-runtime\wrap.js:6:10), <anonymous>:6808:7) at _View._compiled (C:\MyCode\Projects\my-blog\node_modules\hexo\dist\theme\view.js:120:67) at _View.render (C:\MyCode\Projects\my-blog\node_modules\hexo\dist\theme\view.js:37:21) at C:\MyCode\Projects\my-blog\node_modules\hexo\dist\hexo\index.js:60:29 at tryCatcher (C:\MyCode\Projects\my-blog\node_modules\bluebird\js\release\util.js:16:23) at C:\MyCode\Projects\my-blog\node_modules\bluebird\js\release\method.js:15:34 at RouteStream._read (C:\MyCode\Projects\my-blog\node_modules\hexo\dist\hexo\router.js:43:9) at Readable.read (node:internal/streams/readable:739:12) at resume_ (node:internal/streams/readable:1257:12) at process.processTicksAndRejections (node:internal/process/task_queues:90:21) ERROR TypeError: C:\MyCode\Projects\my-blog\themes\butterfly\layout\includes\mixins\article-sort.pug:4 2| .article-sort 3| - let year > 4| - posts.forEach(article => { 5| - const tempYear = date(article.date, 'YYYY') 6| - const noCoverClass = article.cover === false || !theme.cover.archives_enable ? 'no-article-cover' : '' 7| - const title = article.title || _p('no_title')
Cannot read properties of undefined (reading 'forEach') at Object.pug_interp [as articleSort] (eval at wrap (C:\MyCode\Projects\my-blog\node_modules\pug-runtime\wrap.js:6:10), <anonymous>:1749:7) at eval (eval at wrap (C:\MyCode\Projects\my-blog\node_modules\pug-runtime\wrap.js:6:10), <anonymous>:1809:26) at template (eval at wrap (C:\MyCode\Projects\my-blog\node_modules\pug-runtime\wrap.js:6:10), <anonymous>:6808:7) at _View._compiled (C:\MyCode\Projects\my-blog\node_modules\hexo\dist\theme\view.js:120:67) at _View.render (C:\MyCode\Projects\my-blog\node_modules\hexo\dist\theme\view.js:37:21) at C:\MyCode\Projects\my-blog\node_modules\hexo\dist\hexo\index.js:60:29 at tryCatcher (C:\MyCode\Projects\my-blog\node_modules\bluebird\js\release\util.js:16:23) at C:\MyCode\Projects\my-blog\node_modules\bluebird\js\release\method.js:15:34 at RouteStream._read (C:\MyCode\Projects\my-blog\node_modules\hexo\dist\hexo\router.js:43:9) at Readable.read (node:internal/streams/readable:739:12) at resume_ (node:internal/streams/readable:1257:12) at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
doctype html html(lang=config.language data-theme=theme.display_mode class=htmlClassHideAside) head include ./head.pug body !=partial('includes/loading/index', {}, {cache: true})
if theme.background #web_bg(style=getBgPath(theme.background))
!=partial('includes/sidebar', {}, {cache: true})
#body-wrap(class=pageType) include ./header/index.pug
main#content-inner.layout(class=hideAside) if body div!= body else block content if theme.aside.enable && page.aside !== false include widget/index.pug
// Truncates the given content to a specified length, removing HTML tags and replacing newlines with spaces. consttruncateContent = (content, length) => { returntruncate(stripHTML(content), { length, separator: ' ' }).replace(/\n/g, ' ') // 这一行就是 }
// Generates a post description based on the provided data and theme configuration. constpostDesc = (data, hexo) => { const { description, content, postDesc } = data
let result switch (method) { case1: result = description break case2: result = description || truncateContent(content, length) break default: result = truncateContent(content, length) }