Configuring the Namecheap DNS for your Nikola site on Github Pages

Namecheap overhauled their Account Panel a few weeks ago (https://blog.namecheap.com/ready-to-roll-your-new-account-panel/). Nonetheless, the popular guide on Setting the DNS for GitHub Pages on Namecheap is still applicable and the instructions remain practically the same, if not even simpler now due to the new interface.

This posts adapts the steps outlined in the aforementioned guide to the new Namecheap account panel interface and also includes additional steps for static sites generated with Nikola.

Consider the following scenario. You have your static site hosted on your Github User Page at http://<username>.github.io and you just bought a shiny new domain name from Namecheap, say, <username>.me. Say you want to and want to still host your static site on Github, but additioanlly, you would like to:

  • Let <username>.me be the primary domain
  • Redirect <username>.github.io to <username>.me
  • Redirect www.<username>.me to <username>.me

Adding the CNAME file to your repo

We add the CNAME file like we would add any other file in Nikola, by placing it in in the files/ directory, which will then be copied to output by the copy_files task.

$ cd <nikola-project-root>
$ echo "louistiao.me" > files/CNAME
$ nikola github_deploy

https://help.github.com/articles/tips-for-configuring-an-a-record-with-your-dns-provider/#configuring-a-www-subdomain

Comments

Comments powered by Disqus