部署hexo遇到的问题


title: hexo报错Cannot read property 'groupBy' of undefined
date: 2021-08-12 09:23:48
tags: hexo groupBy


1.hexo g时报错

Cannot read property 'groupBy' of undefined

2.处理

网上大多数是说lodash函数引起的,我安装了:
npm install lodash
hexo g时还是报上述错误

最后屏蔽掉文件archive.jade如下内容,即可:
文件:themes/maupassant/layout/archive.jade
使用//进行屏蔽

extends base

block title
  if page.category
     title= page.category + ' - ' + config.title
  if page.tag
     title= page.tag + ' - ' + config.title
  if page.archive
     title= __('archive') + ' - ' + config.title
block content
  if page.category || page.tag
      h1.label-title=  __('reading_label', page.category || page.tag)
  .post
    .post-archive
        //-Use lodash to classify posts. See https://lodash.com/docs#groupBy
        if page.category || page.tag
//          each posts, year in _.groupBy(page.posts.toArray(), function(p){return -p.date.format('YYYY')})
//           h2= -year
//            ul.listing
//              for post in posts
//                li
//                  span.date= post.date.format('YYYY/MM/DD')
//                  a(href=url_for(post.path), title=post.title)
//                    +title(post)
//        else
//          each posts, year in _.groupBy(site.posts.toArray(), function(p){return -p.date.format('YYYY')})
//            h2= -year
//            ul.listing
//              for post in posts
//                li
//                  span.date= post.date.format('YYYY/MM/DD')
//                  a(href=url_for(post.path), title=post.title)
//                    +title(post)
// 归档默认在全站目录下展示全站所有文章,在分类及标签目录下展示分类和标签的所有文章               
// 如需要归档分页,需要删除上面if判断(保留if代码块代码),和else判断(删除else代码块代码),以及取消下面include引入分页组件的代码即可
// include _partial/paginator.jade
END

时代在变,思想要变

博客:www.varetwo.com

最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容