Example #1
0
def get_posts_by_tag(name):
    posts = []
    for post in get_posts():
        post_tags = [tag.lower() for tag in post.config.get('tags', [])]
        for tag in post_tags:
            if tag == name and post not in posts:
                posts.append(post)
    return posts
Example #2
0
def get_archive():
    archive = {}
    for post in get_posts():
        if not archive.has_key(post.pub_date.year):
            archive[post.pub_date.year] = {}
        if not archive[post.pub_date.year].has_key(post.month):
            archive[post.year][post.month] = []
        archive[post.year][post.month].append(post)
    return archive
Example #3
0
def get_tags():
    tags = {}
    for post in get_posts():
        post_tags = [tag.lower() for tag in post.config.get('tags', [])]
        for tag in post_tags:
            if tag not in tags:
                tags[tag] = 1
            else:
                tags[tag] += 1
    return tags