Follow my other guide here 1st to set up a hexo blog site

A CNAME is basically a redirect to a domain you are renting through a domain registar

How to set up overview

To do this, you need to do two things

  1. Your site’s root directory or public folder needs a file called CNAME with the URL such as
  2. You need your domain registar (e.g. namecheap) to point that domain to your site.

Adding CNAME to your source folder (Hexo) or root directory

Adding a cname to the hexo blog is simple. However, with Hexo you don’t put the cname in the root directory, rather you put it directly inside the /source folder

Add a new file called CNAME, inside put the name of the file

Save the file

Pointing DNS

Sign in onto your namecheap account or whatever domain registrar you are using

I followed this guide namecheap guide

Navigate to advanced DNS to this page:

Add records first

  • A record for @ pointing to
  • A record for @ pointing to
  • CNAME record for www pointing to your (the username should be replaced with your actual GitHub account username):


Delete the other records. It should look like this

Need to wait 30 minutes for this to take in effect (according to namecheap)


If you type in the domain too early before effects are in, you can see what a CNAME does on github’s side

(notice the 404 error on github pages)

after waiting for about 30 minutes the results are good

Vincent Tang