While looking into a way to speed up my website, I also found a way to have it hosted for free. Best of both worlds? Pretty much, though there are a few caveats.
Previously I had a WordPress site on a paid hosting platform. This worded out pretty well. I could add a bunch of different plugins and do all sort of neat stuff with my site. It was very easy to setup, update, and do… whatever I wanted.
Because it was WordPress, I also had to make sure everything was up-to-date all the time. If you leave plugin un-updated, it could mean disaster for your site, and since I didn’t post on my site much,it could be weeks or even months before I realized there was a problem.
There was also the performance aspect. WordPress is pretty fast with a decent caching plugin, but with a hefty core codebase and a few plugins, it can slow it down a bit. It’s typically still going to be a livable speed, but I want lightning fast.
In comes Hugo
I decided that since my site rarely changes, it might be time to look for a static site generator. A static site generator takes content in some format and some html templates along with some static files and makes a static site. It allows for a super fast site that also has the flexibility to easily change. I had a contact form on my old site, but I rarely get anything useful from it, so I decided to scrap it.
The first one I tried was Jekyll. It seems to be the most popular static site generator right now, so I figured it would be easy to find themes and support. I had some trouble installing it, and when I glanced at the next one on the list, I found that it was written in Go. Sign me up! As a sys admin, I appreciate Go because it’s fast and all of the dependencies are compiled in, so it’s easy to install.
That Go-based static site generator was Hugo. Hugo is not only a static site generator, but it can also serve pages directly. While it’s running, it’ll watch your files, and regenerate pages when something changes. It took me just a few hours to figure out go, find a theme I like, and convert all of my content to Markdown, the format Hugo uses.
After getting my site static-ified, I was looking around for how I was going to host my. My first thought was write a script to generate the static pages and upload them to S3. I then found Netlify. Netlify is pretty similar to Heroku, in that you just get a Git repo to add your code to and they handle the rest. Netlify is specifically just for front-end code though, so they won’t host any dynamic content.
Netlify also allows for a build command, so I can commit my code and have Hugo automatically build my static site on Netlify’s servers. All I do is commit some Markdown and a new post shows up in a few seconds.
The best part about Netlify is that their bronze plan gives you all of the basic features for free. There’s a ton of advanced features that are pretty cool looking, but I don’t need any of that for my personal site. The icing on the cake is that Netlify also has some code that you can add to a site to create a contact form, and they’ll handle the submission.
Overall, I’m pretty happy about the switch. There are obviously some limitations with a static site, but it suits my needs, and my site is now lightning fast.