2

I created my blog website in Hexo, and I am using the default hosting that Github provides. Github allows you to specify the default name of your domain just like that:

enter image description here

As you can see my default url: ponyczek.github.io has been set to htttp://donutdev.pl. So far so good. The problem occurs when I write a new post for my blog in hexo and I deploy it to my repository. What happens is that my

Custom domain

The field gets overwritten back to the default ponyczek.github.io which is a bit of a pain. I need to go to my repository settings and change it back to what it was before. This happens after every single deployment. Here the content of my: CNAME file

donutdev.pl

halfer
  • 19,824
  • 17
  • 99
  • 186
Adrian Grzywaczewski
  • 868
  • 1
  • 12
  • 25

3 Answers3

3

When you configure a custom domain in github settings, it will automatically generate a CNAME file for you in the root of your github repository. This file does not exist in your local hexo project though, so it will be removed when hexo pushes to the repository. In order to avoid this, you need to put the generated CNAME file in the source folder of your hexo project.

AMO
  • 676
  • 1
  • 7
  • 13
0

Adding to the answer by AMO, every time you do "hexo deploy", your GitHub repo is overwritten. So unless you have the CNAME file in your local copy of hext project, your github pages will keep missing the custom domain setting. You can create a CNAME file in your local hexo project by adding a one line entry of your custom domain name. For example, if your custom domain is myblog.com, then just put it in a file and name it as CNAME.

0

This website has given the answer.

Note - if you specify a custom domain name with a CNAME, you need to add the CNAME file to the source/ folder. More info.

Saint
  • 1,492
  • 1
  • 11
  • 20