hexo-deployer-git icon indicating copy to clipboard operation
hexo-deployer-git copied to clipboard

When Deploying, Resets My Custom Domain

Open ToddAT opened this issue 8 years ago • 4 comments

When using the deploy script, I've noticed that my custom domain configuration gets overwritten/reset. Is there something I need to set in the config? Otherwise, any idea how to fix this?

ToddAT avatar Oct 12 '17 03:10 ToddAT

@ToddAT make your CNAME file under source folder.It will be copied to root when build result.

revan-zhang avatar Oct 12 '17 08:10 revan-zhang

That's worth being added to the README.md

green-coder avatar Nov 11 '17 06:11 green-coder

Agree, please add this to the README as I was super confused. Thanks.

erikh avatar Jan 19 '21 10:01 erikh

just write below codes to generate in root hexo site project. Lets assume <hexodir>/generate.js

const Hexo = require("hexo");
const fs = require("fs");
const path = require("path");

const hexo = new hexo(__dirname);
hexo
  .init()
  .then(hexo.load)
  .then(() => hexo.call("generate"))
  .then(() => {
    fs.writeFileSync(
      path.join(__dirname, "public/CNAME"),
      "www.example.net"
    );
  })
  .catch(hexo.exit);

usage: node generate.js

it should be generate the site and creating CNAME after generated

OR

creating CNAME inside source directory

OR for developer this plugin

add cname key to option and push function to event generateAfter

dimaslanjaka avatar Jan 03 '23 19:01 dimaslanjaka