mhgbrg / personal-website

My personal website and blog. Uses a script that parses posts from Markdown files and spits out static html.
0 stars 1 forks source link

Check if some functional programming method could be used to group posts by tags #76

Closed mhgbrg closed 8 years ago

mhgbrg commented 8 years ago

This is the code block that should be reworked:

all_tags = {}
for post in posts:
    try:
        tags = post['tags']
        for tag in tags:
            if tag not in all_tags:
                all_tags[tag] = []
            all_tags[tag].append(post)
    except KeyError:
        # Post has no tags.
        pass