def index(page=1):
"""Show the list of published posts.
Args:
page (int): Listing page number to show.
"""
posts = (
Post.query
.filter_by(is_published=True, ghost='')
.order_by(Post.timestamp.desc())
.paginate(page, 10, False)
)
try:
return render_theme('blog/index.html', posts=posts)
except NotFound:
# Show a 'no posts found' notice instead of a 404 error
return render_theme('blog/index.html')
评论列表
文章目录