Add custom domain to your Hexo blog

Prerequisite:

  1. git installed
  2. node.js installed
  3. your domain (e.g. buy it from some domain selling website like Godaddy etc.)
  4. assume your website is built on github pages (i.e. username.github.io)

Step 1: Change the nameservers of your domain

Follow this Youtube video to build the github pages and manage your domain/nameservers.

Step 2: create hexo blog folder

Follow this Zhihu Post, ignore the customizaiton of CNAME section.

Step 3: Add CNAME

After you follow step1, you should acquire a blog on github pages, despite that it's not connected to your webstie because the CNAME is not in the root directory.

Then, do the following:

  1. Add the CNAME file into \source folder (in you local hexo blog folder) - yes, there is no \source folder in your github (if you already deploy hexo onto github), don't worry the github directory is actually inside the '\source' and that's why you can't see it.
  2. Deploy again using hexo d and wait for a while. You will see that your github pages is now connected with your custom domain.