Kitware / kw-doc

Static website generator based on Hexo to build developer documentation
2 stars 3 forks source link

Custom domain #3

Closed vibraphone closed 6 years ago

vibraphone commented 6 years ago

kw-doc does not appear to support github custom domain pages. I'm able to run the kw-doc script but setting the base url to "/"... and running kw-doc -s on my laptop causes problems. For instance, with this config.js:

module.exports = {
 baseUrl: '',
 work: './build-tmp',
 config: {
   title: 'project',
   description: '"Scalable stuff."',
   subtitle: '"Lightweight, zero-copy stuff."',
   author: 'the dude',
   timezone: 'UTC',
   url: 'https://thedude.github.io/',
   root: '/',
   github: 'thedude/project',
 }
};

it still tries to redirect localhost:4000/ to localhost:4000/project .

  1. A good starting point is https://github.com/vibraphone/kwdoc-experiment.git . The difference between the master and custom-domain branches shows what I changed to make the document root be "/".

  2. On the custom-domain branch, running "npm run doc:www" a. redirects http://localhost:4000/ to http://localhost:4000/kwdoc-experiment/ b. properly displays http://localhost:4000/index.html c. makes the logo at the top-left of the page(2b) link to "/kwdoc-experiment" which is wrong. d. Serving the static content with "python -m SimpleHTTPServer" works except for the bad link in 2(c), so 2(a) is a hexo config issue.

jourdain commented 6 years ago

It is working but when changing the configuration like that, you need to delete ./build-tmp otherwise the old generated files remain the same...

vibraphone commented 6 years ago

I don't know if it's a bug in kw-doc or hexo, but I've run into an issue where the generated gh-pages branch for the sensei repo is missing a CNAME file. I've checked that doc/config.js includes a "cname" key-value pair.

Without this file, github resets the "Custom domain" text entry to an empty string after about 15 minutes.

I've fixed things manually by commiting a CNAME file by hand in the gh-pages branch, but it would be nice to fix this so the next website update doesn't break things.

jourdain commented 6 years ago

Didn't that work?

https://github.com/vibraphone/kwdoc-experiment/commit/73a77d14b6a13501a200649f522f68a21cd24942

vibraphone commented 6 years ago

Didn't that work?

vibraphone/kwdoc-experiment@73a77d1

I did not have a domain and control over dns records to test that against. When the admins redirected sensei-insitu.org , I discovered the published gh-pages branch for github.com/Kitware/sensei did not have a CNAME file as required. It took my manual commit to fix things.