June 13 2020
On Twitter, Shihab Mehboob recently asked about Medium alternatives. I've always been a proponent of having a website that you control. While Medium certainly has benefits, just like Twitter, it's not your website. The company could go bankrupt, they could decide to focus on their own content and remove all user-created articles, or do something else that would take away your audience. Even though these scenarios currently don't seem likely, that could change in the future. So here's how this blog is hosted:
Everything starts with the domain. Hover has made it very easy to buy and manage domains. There's not much to it: You buy the domain and configure it to point to your host. Hover has excellent documentation and customer support. They support many of our favorite podcasts, so you should consider supporting them.
Now you'll need a host to point your new domain at. I use Netlify because of its great build image and competitive pricing. If you don't need analytics (I don't), Netlify is essentially free. My code to statically generate this blog is on GitHub as a private repository and Netlify can be set up to automatically deploy from GitHub. This wouldn't make much sense though if it would only copy the repository onto the server. Instead, you can add a build command to your site which will run every time you make a commit to your website's repository. I added
swift run so my website would be generated automatically. This means I can update an article on my phone and Netlify's servers will take care of generating the website.
Swift is relatively new to the Netlify build image so make sure you're using the latest version.
Static Site Generation
For a lot of websites, using a CMS is the right choice. For a small blog like mine though, static site generation is a way better solution. Static pages are faster to load and put way less strain on the server. Until recently, I used Jekyll to generate my website but a couple of weeks ago, I switched to John Sundell's Publish. Publish is a static site generator written entirely in Swift. It's pretty neat. Instead of having to use a weird template language to build your site, you can build it entirely in Swift. Yeah, no HTML! The posts themselves are just markdown files in the
Migrating my site took me a couple of days but now it's way easier to configure and update. The publishing system even supports features like podcasts, which I don't currently make use of.
Plot's integration with Splash is incredible. If you write a blog about Swift, staying in the Sundell ecosystem makes everything way easier.
While I might add a CDN such a Cloudflare to my website in the future, I'm pretty happy with my current setup. It's easy to publish new articles and the system is reliable. I never even have to see the Netlify's web interface or configure any web servers. For me, that's a success.