Configuring the Namecheap DNS for your Nikola site on Github Pages

Namecheap overhauled their Account Panel a few weeks ago ( 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> 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> 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 "" > files/CNAME
$ nikola github_deploy


Comments powered by Disqus