Skip to content

Commit

Permalink
Use native JavaScript over Lodash
Browse files Browse the repository at this point in the history
Since Hexo 5.0.0 removes Lodash from global variable. See hexojs/hexo#4266
  • Loading branch information
zklhp authored Jul 30, 2020
1 parent e16b8ab commit 2b94695
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions layout/archive.pug
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ block content
h1.label-title= __('reading_label', page.category || page.tag)
.post
.post-archive
//Use lodash to classify posts. See https://lodash.com/docs#groupBy
each posts, year in _.groupBy(page.posts.toArray(), function(p){return -p.date.format('YYYY')})
- var allposts = page.posts.toArray().reduce((r, v, i, a, k = -v.date.format('YYYY')) => ((r[k] || (r[k] = [])).push(v), r), {})
each posts, year in allposts
h2= -year
ul.listing
for post in posts
Expand Down

0 comments on commit 2b94695

Please sign in to comment.