Improving the site (2023)

Sat Apr 08 2023

tags: public blog programming


I have been making new posts regularly, but haven't changed either the design or the backend of the website since 2020. Time flies! I wanted to do it back in 2022 but 2022 was a very busy year for me. Thankfully things are less hectic now.

Removed Github Pages Actions, moved to Vercel

It was taking upwards of 20 minutes for any change to reflect on my website after I pushed the changes. It turned out that Github Actions save something called an artifact, which took a long time (~10 minutes!) given my many huge files in the repo.

Serving purely static files shouldn't take anywhere near that long. I switched to Vercel instead, now it builds in seconds. I'm still using GitHub Actions to run eleventy build and encryption (see next section)

Add encryption for private posts

I used to keep private posts up, but events transpired that made this no longer a good idea. I took them down for over 2 years but was always looking for a way to keep them up with password protection. (see my 2022 post). I'd been thinking of a way to do client-side encryption. Two months ago I found a HN post doing exactly that -- and I finally took the time to set up use pagecrypt.

I tag private posts in the front matter with tags: ["private", "bla", bleh]. The compiled .html file results in an anchor element <a href="/tags/ private"> private </a>. I grep for this and password-protect it with npx pagecrypt.

I have a passwords.txt file that lets me set a different password for each file, with a default password as fallback:

default: wouldnt_you_like_to_know
_site/test_private_post/index.html: hunter2

I add the following action after npx eleventy:

default_password=$(grep "^default: " $password_file | cut -d ' ' -f 2)
for filename in $(grep -rl "/tags/ private" _site); do
password=$(grep "^$filename: " $password_file | cut -d ' ' -f 2)
if [ -n "$password" ]; then
npx pagecrypt $filename $filename $password --iterations 2e6
npx pagecrypt $filename $filename $default_password --iterations 2e6

Check it out -- a super private post. The password is definitely not hunter2.

This is kind of a hack because I'm relying on the final .html file output having the text string /tags/ private in it. Additionally, any post that mentions /tags/ private will be password protected. So I've made sure to put a space here. This will change if I change the layout of my Nunjucks post template in the future. I'll keep looking for more elegant solutions.

Spring cleaning cruft

This website has been up at the same website since 2016 -- that's seven years now. I'm glad to have maintained continuity of the site, but there's a lot of cruft accumulated over the years. e.g. lots of orphan tags, weird bash scripts, commented out code, code in eleventy.js that I'm not sure does anything.

I moved/deleted/cleaned up various files.

Updating old descriptions

I cleaned up some of the old descriptions, updating the About and Resume pages.

What's next?

Not sure. I think there's more cruft I can slowly clean up. Does the website design look dated? I want to implement full text search eventually. Minisearch, Lunr and Fuse.js are good candidates.