def blog_archive(year, month): key = 'blog_archive_%s_%s' % (year, month) posts = get_posts() tags = get_tags() dates = get_dates() archive_posts = [] for post in posts: if post['created'].month == month and post['created'].year == year: archive_posts.append(post) return render_template('blog/archive.html', posts=archive_posts, tags=tags, dates=dates)
def blog_index(): posts = get_posts()[:20] tags = get_tags() dates = get_dates() return render_template( 'blog/index.html', posts=posts, tags=tags, dates=dates)
def blog_tagged(tag): tags = get_tags() dates = get_dates() tagged_posts = [post for post in get_posts() if tag in post['tags']] return render_template('blog/tagged.html', tagged_posts=tagged_posts, tag=tag, tags=tags, dates=dates)