Created
November 29, 2009 06:42
-
-
Save EnigmaCurry/244821 to your computer and use it in GitHub Desktop.
A single page indexing all the categories and posts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%inherit file="_templates/site.mako" /> | |
<% | |
# Generate a map of categories to posts | |
category_post_map = {} | |
for p in bf.posts: | |
for c in p.categories: | |
try: | |
category_post_map[c.name].add(p) | |
except KeyError: | |
category_post_map[c.name] = set([p]) | |
%> | |
<ul> | |
% for category, posts in category_post_map.items(): | |
<li>${category} | |
<ul> | |
% for post in posts: | |
<li><a href="${post.permalink}">${post.title}</a></li> | |
% endfor | |
</ul> | |
</li> | |
% endfor | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment