Skip to content

Commit

Permalink
Fix #84: sort tags by post count
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Dec 27, 2023
1 parent 5bfa6bc commit 5ed5519
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/quickblog/api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@
posts-by-tag (lib/posts-by-tag posts)
tags-file (fs/file tags-out-dir "index.html")
template (base-html opts)]
(when (or (not (empty? modified-tags))
(when (or (seq modified-tags)
(not (fs/exists? tags-file)))
(lib/write-page! opts tags-file template
{:skip-archive true
Expand Down
3 changes: 1 addition & 2 deletions src/quickblog/internal.clj
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@
{})))

(defn- load-favicon [{:keys [favicon
favicon-dir
templates-dir]
:as opts}]
(when favicon
Expand All @@ -381,7 +380,7 @@
:tag tag
:count (count posts)}) tags)]
(selmer/render (slurp tags-template) {:title title
:tags tags})))
:tags (sort-by (comp - :count) tags)})))

(defn render-page [opts template template-vars]
(let [template-vars (merge opts template-vars)
Expand Down

0 comments on commit 5ed5519

Please sign in to comment.