Blog Post Editor

The last feature related to blog posts is a post editor that allows users to edit their own posts. The blog post editor lives in a standalone page and is also based on Flask- PageDown, so a text area where the Markdown text of the blog post can be edited is followed by a rendered preview.

Using Flask-PageDown

With these changes, Markdown-formatted text typed in the text area field will be immediately rendered as HTML in the preview area below. Figure 11-3 shows the blog submission form with rich text.

Creating Fake Blog Post Data

To be able to work with multiple pages of blog posts, it is necessary to have a test database with a large volume of data. Manually adding new database entries is time consuming and tedious; an automated solution is more appropriate. There are several Python packages that can be used to generate fake information. A fairly complete one is Faker, which is installed with pip:

Paginating Long Blog Post Lists

As the site grows and the number of blog posts increases, it will become slow and impractical to show the complete list of posts on the home and profile pages. Big pages take longer to generate, download, and render in the web browser, so the qual‐ ity of the user experience decreases as the pages get larger. The solution is to paginate the data and render it in chunks.

1 2 3

Our Sidebar

You can put any information here you'd like.

  • Latest Posts
  • Announcements
  • Calendars
  • etc