This plugin allows you to have password protected articles and pages in Pelican. The content is encrypted with AES-256 in Python using PyCryptodome, and decrypted in the browser with Crypto-JS.
Refer to How to use plugins in the Pelican docs.
Pelican 4.5 switched to namespace packages for plugins. Run python setup.py install
and Pelican will auto-detect the plugin.
Verify installation by running pelican-plugins
. You should see something like:
-> Plugins found:
| pelican.plugins.encrypt_content
Copy the pelican/plugins
folder from this repository into the top level of your pelican project, then add the
following to pelicanconf.py
:
PLUGIN_PATHS = ['plugins']
PLUGINS = ['encrypt_content']
You can set a summary, as well as a title prefix to use for all encrypted articles. The default for both is a blank string.
In pelicanconf.py
file:
ENCRYPT_CONTENT = {
'title_prefix': '[Encrypted]',
'summary': 'This content is encrypted.'
}
Inside your source file, just add the password of your choosing:
ex.
That one time I robbed a bank
###############################
:date: 1983-04-22
:tags: crime, banks, imabadass
:password: correcthorsebatterystaple
Title: That one time I robbed a bank
Date: 1983-04-22
Tags: crime, banks, imabadass
Password: correcthorsebatterystaple