This post is part 3 of the "Building a Blog" series:

  1. Building a Blog: Overview
  2. Building a Blog: Generating Static Files
  3. Building a Blog: Authentation
  4. Building a Blog: Deploy

There's a pelican-encrypt-content plugin for encrypting single post, but static pages does not support sessions. Whenever I tried to open a encrypted page, I need to enter a password, that can be annoying.

I have to add a dynamic layer ontop of these static pages. This task itself is infact simple, but it will make the deploy step much more complicated. For deployment I'll talk about in the next post.

Implementation

As described earlier, I've collected all confidential urls already, and the urls is just the path of the corresponding htmls saved on the dist. So all I need to do is parse the requested url, figure out the access status, and send a response. I also need to provide an additional route for logging in. Using flask it's just a few tens lines of code.