Removing JavaScript

14 May 2019 ∞

My website has always been both a way for me to show my work & hobby for me to tinker with. Over the last year I've moved to self-hosting a staticly generated site and customized various themes within an inch of their lives.

Today I'm changing things up again. This time to remove JavaScript.

Inspired by a post by Brent Simmons talking about a web browser that disables JavaScript by default:

If it‘s the opposite — if I have to blacklist instead of whitelist — then I’d be constantly blacklisting. And, the first time I go to a site, it gets to run code before I decide to allow it.

It got me thinking about my website with its fancy masonry galleries, responsive navigation bar, and syntax highlighting and whether I needed JavaScript. As it happens: I don't.

Unfortunately I am not a web developer, so I had to rely on cleverer people. After a lot of research and false starts1 I found some projects I was able to use:

  1. Masonry Gallery: Driveway
  2. Responsive Navigation: Luxbar
  3. Syntax Highlighting: Built into Hugo

With these components in place I also had a mostly fresh start and got to clean up the look of my site a little. The galleries are now first class layouts and all of the little overrides I'd made are integrated in the Hugo theme directly.

There are a few limitations to removing JavaScript. The main one for me is it reflows my gallery order. It's not a huge issue, and it's something that could be fixed with a small script, but I didn't set out to remove almost all JS. I can always backpedal a bit, but it's nice to not be reliant on it just to make my site work at all.

Blog Updates

I've also moved away from pagination on my blog. The main blog page will show a list of recent posts and the rest are at the new archive page.

  1. Shockingly, not everything posted on Stack Overflow works ¯\_(ツ)_/¯