From: Oleg Broytman Date: Wed, 2 Oct 2024 14:44:07 +0000 (+0300) Subject: Fix(reindex_blog): Sort tags X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=2239c5950dce78aad0c7e94f3305b8d897142cf4;p=phdru.name%2Fphdru.name.git Fix(reindex_blog): Sort tags Sort by count descending; for the same count sort by name ascending. --- diff --git a/reindex_blog.py b/reindex_blog.py index 3370d6f..3b4e10d 100755 --- a/reindex_blog.py +++ b/reindex_blog.py @@ -321,7 +321,7 @@ def by_count_rev_tag_link(tag): """Sort all_tags by count in descending order, and by tags and links in ascending order """ - return tag[:3] + return -tag[0], tag[1], tag[2] all_tags = [(len(links), tag, links) for (tag, links) in all_tags.items()] all_tags.sort(key=by_count_rev_tag_link)