How to move your GitHub pages blog to Netlify

I bought to use for this blog. I tried using GitHub’s custom-domain support, but found that they still don’t support HTTPS. Therefore I’ve moved the hosting to Netlify. Netlify is a free static site host. I’ve used Netlify before to host, Pusher’s engineering blog. This was a smooth and friendly experience, so I decided to do the same for my personal blog.

The process was:

  1. Create a new Netlify site.
  2. Tell Netlify that this site will use the custom domain
  3. Create a DNS A record pointing to Netlify’s load balancer’s IP address. Namecheap’s DNS doesn’t support ANAME or ALIAS records, which are preferred for apex domains. CNAME records don’t work well with apex domains like I’ll cover that in a future post. Also, Namecheap has some BS “URL redirect record” which I don’t think is properly a DNS record at all. I deleted that. In the future I’d like to move the DNS away from Namecheap. Another future post.
  4. Request a Let’s Encrypt TLS certificate via the Netlify dashboard. Netlify requests the certificate, and proves control of the domain by hosting a challenge on that domain (I assume).
  5. Wait around for the Let’s Encrypt certificate. This should take a few seconds, but took ages. I think this is because of Namecheap’s BS “URL redirect record”, which added another A record, which then got cached for ages.
  6. Enable “Force TLS connections” in the Netlify dashboard.
  7. Add <link rel="canonical" .../> tags to point to the new domain (see tomorrow’s post).
  8. Clone the repo to a new GitHub repository, This will be the repository backing the new site, and the old repository will only be kept for redirects.
  9. Point Netlify at the new repository.
  10. Add <meta http-equiv="refresh" content="0; ..."/> tags to the old site.
  11. I need to keep the GitHub hosting around to redirect to the new domain. Maybe I’ll remove the site some day, but I’ll keep it around for now.