I’ve been off social media for a while now and one thing I miss is occasionally sharing stuff about my life with friends and family. I like the idea of my personal website functioning in a similar way as my former facebook profile did: a platform that I can use to share about myself, except that I have (almost) complete ownership and (a bit more) control over the information that I share. But I don’t really want to share everything with everyone, so a plain public website wouldn’t work for what I have in mind. It would, though, if I encrypted content I don’t want to be public.
So, how do I encrypt content
I am using hugo for my blog, so I searched github if anyone already came up with a solution to encrypt/decrypt content with hugo. I found hugo-encrypt, a “port of hugo_encryptor in golang” and it was close to what I had in mind. I made a few changes and improvements, set up an automated build so I can use it in my drone pipeline and can now use the following shortcode to encrypt content:
{{% hugo-encrypt "passwd" %}}
This content is encrypted.
{{% /hugo-encrypt %}}
Which renders to:
passwd.
I can use a ‘per-post’ passphrase as shown in the example, or –if not set in the shortcode– use the default passphrase that I set in my config.toml.
[params.hugoEncrypt]
password = "omgwtf"
For details on how to implement this refer to the readme of the repository.
I’m well aware how unusual and silly this is, and how unlikely it is that anyone asks me for the passphrase of a certain post 😸 .. but it’s a fun experiment and maybe it helps me feel a bit more comfortable expressing myself online.