Skip to content

Commit

Permalink
Merge pull request #535 from tatut/main
Browse files Browse the repository at this point in the history
Bugfix, skip author who has no info
  • Loading branch information
tatut authored Oct 14, 2024
2 parents 5b99d4e + 80a5d8a commit 1e6d6c3
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions authors.clj
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,19 @@ to a jekyll page link:
(for [author authors]
{:title title :author author :url (file->relative-url f)}))))
(group-by :author)
(map (fn [[author posts]]
;; sort by date (part of filename)
(assoc (author-by-handle author)
:handle author
:posts (->> posts
(map #(dissoc % :author))
(sort-by :url)
reverse))))
(sort-by (comp count :posts))
(keep (fn [[author posts]]
;; Only include author who has author info in config
(when-let [author-info (author-by-handle author)]
(merge author-info
{:handle author
:posts (->> posts
(map #(dissoc % :author))
;; Sort posts by URL (which starts with date)
(sort-by :url)
reverse)}))))
;; Sort by number of posts and latest post URL
(sort-by (juxt (comp count :posts)
(comp :url first :posts)))
reverse))

(spit "_data/authors.json" (json/generate-string author->posts))

0 comments on commit 1e6d6c3

Please sign in to comment.