Roland's homepage

My random knot in the Web

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 I modified that as follows;

diff --git a/ b/
index 5122fa6..8d81f60 100644
--- a/
+++ b/
@@ -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.

←  Writing the README first Unicode characters  →