简体   繁体   中英

How to prevent CNAME file from getting dropped during Jekyll build process

I'm using Jekyll with Forestry.io and GitHub Pages. Everything seems to be working properly except for when the build process runs and the site is copied to the gh-pages branch. All of the static files (eg. robots.txt and sitemap.xml) get copied, but the CNAME file for my custom domain does not.

If I change the file name to all lowercase ( cname ) then it gets copied. But GitHub Pages doesn't recognize a cname file.

I don't think anything in the build portion of the Forestry.io settings would cause this issue.

build:
  preview_command: bundle exec jekyll build --drafts --unpublished --future -d _site
  publish_command: bundle exec jekyll build -d _site
  preview_env:
  - JEKYLL_ENV=staging
  publish_env:
  - JEKYLL_ENV=production
  preview_output_directory: _site
  output_directory: _site

Are you publishing your build to Github Pages? Github Pages can/should contain the (Jekyll) source, not the build. So to be extra clear: Github Pages should contain .md files and not (built) .html files. The CNAME file is designed to be used by Github Pages, so Github Pages is not the culprit. Forestry.io or your build process probably is. Forget about the build process and publish your changes directly to your github pages branch. That should do the trick.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM