Tom MacWright


Castle watercoloring is now served over HTTPS.

I rarely change the stack of this website - after switching from Tumblr in 2011, I’ve stayed with Jekyll and, besides deleting code, haven’t changed that much. But I feel strongly that HTTPS should be a web-wide standard, so I’ve abandoned GitHub Pages in favor of Netlify. Netlify gets me the same ‘publish on commit’ workflow as Pages, as well as the ability to do fancier build processes or switch to newer static site generators like Hugo, though I haven’t yet and don’t have concrete plans to. Plus, they use Let’s Encrypt to provide SSL on custom domains even on their free plan, the free, automatable certificate authority that people are justifiably excited about.

The process isn’t terribly interesting, but the one quirk that I did have to work around is GitHub Pages’s behavior when it comes to repositories under your username.

The rules, for GitHub pages, are as such:

Netlify doesn’t support this pattern yet, as far as I know, and I also didn’t really want to continue relying on it. So instead I wanted to serve biggie and other gh-pages branches from, like

Unfortunately, I have 169 repositories under my user, so manually finding every gh-pages branch would be a pain. So I wrote this tiny utility in clojure that scans all of my repositories and generates redirects, which I then added to this website. clojure is quite a lovely language, and I think it’ll be my preferred tool for this kind of scripting in the future.

I also had to deal with a lot of legacy cruft, like HTTP image urls to Flickr from 2011. For that, I used sed, the ancient ‘stream editor’ utility with which I am slowly forging a friendship. Here are some of the sed tricks:

Update internal links, so they don’t have to be redirected

sed -i '' 's,,,g' _posts/*.md

Update Flickr URLs

sed -i '' 's,http://farm,https://farm,g' _posts/*.md

Update Amazon URLs

sed -i '' 's,http://amzn,https://amzn,g' _posts/*.md

Update <iframe> src attributes

sed -i '' "s,src='http:,src='https:,g" _posts/*.md

That’s it! The above castle is Neuschwanstein.

May 08, 2017 @tmcw