def feed():
"""Return an atom feed for the blog."""
feed = AtomFeed(
'%s: Recent Posts' % app.config.get('SITENAME', 'akamatsu'),
feed_url=request.url,
url=request.url_root
)
posts = (
Post.query
.filter_by(is_published=True, ghost='')
.order_by(Post.timestamp.desc())
.limit(15)
)
for post in posts:
# unicode conversion is needed for the content
feed.add(
post.title,
markdown.render(post.content).unescape(),
content_type='html',
author=post.author.username,
url=url_for('blog.show', slug=post.slug, _external=True),
updated=post.timestamp
)
return feed.get_response()
评论列表
文章目录