Open navClose nav

How do I add a CNAME to my site?

For some hosting providers (such as GitHub pages) you will need to place a CNAME file in the root of your site.

You’ll need to ensure that the CNAME file is treated as a static file, so that it is copied to the root of your site during the build.

Make sure you place your CNAME file in your source directory, not your build directory. Otherwise it will be deleted during the next build

Examples

  • Jekyll: any file without front matter is treated as a static file, so place your CNAME file in the root of your source folder
  • Hugo: any file inside of the static/ directory in your source folder is treated as a static file.
  • VuePress: files inside of .vuepress/public are treated as static files.

Last updated on January 2, 2018