Modifying pelican
By default, the pelican blog generator that I use creates a random tag cloud. I wanted one that was alphabetically sorted. So I modified the source code.
Some digging into the pelican source code pointed me to the file
generators.py
. I modified that as follows;
diff --git a/generators.py b/generators.py
index 5122fa6..8d81f60 100644
--- a/generators.py
+++ b/generators.py
@@ -577,7 +577,10 @@ class ArticlesGenerator(CachingGenerator):
for tag, count in tag_cloud
]
# put words in chaos
- random.shuffle(self.tag_cloud)
+ # random.shuffle(self.tag_cloud)
+
+ # sort the tag cloud alphabetically
+ self.tag_cloud.sort(key=lambda t: str(t[0]).lower())
# and generate the output :)
Later I found a plugin that allows configurable sorting for the tag cloud or a random tag cloud. But for me this is a simpler solution.
For comments, please send me an e-mail.
Related articles
- Python bindings for libmagic
- Updating the site generator “pelican” to 3.5.0
- Stltools
- Making my first e-book
- Filtering a sound recording