Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@RobinCPC
Last active September 3, 2021 02:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobinCPC/7d8c4c323c486ad6a078cca9b34c15f9 to your computer and use it in GitHub Desktop.
Save RobinCPC/7d8c4c323c486ad6a078cca9b34c15f9 to your computer and use it in GitHub Desktop.
Doxygen deploy in gh-pages and some page can't be seen (content security policy)

In NexMotion API repo, some source file start with capital char (such as NexMotion.h). Doxygen will generate Corresponding html file with underscore (such as _nex_motion_8h.html).

By default, github pages attempt to use Jekyll handles file name with underscores differently, so cause some unsual content policy security error To prevent it, create a file called .nojekyll in the root of your repository / site folder.

# Need to create a .nojekyll file to allow filenames starting with an underscore
# to be seen on the gh-pages site. Therefore creating an empty .nojekyll file.
# Presumably this is only needed when the SHORT_NAMES option in Doxygen is set
# to NO, which it is by default. So creating the file just in case.
echo "" > .nojekyll

when deploy with trvisCI by yaml

script:
  - mkdir build && cd build
  - cmake .. -DCMAKE_BUILD_TYPE=Release
  - make
  - make install
  # create a .nojekyll file to allow filenames starting with an underscore to be seen on the gh-pages site.
  - cd ..
  - echo "" > ./docs/html/.nojekyll

deploy:
  provider: pages
  skip_cleanup: true
  local_dir: docs/html
  github_token: $GH_REPO_TOKEN
  on:
    branch: master

Reference:
https://gist.github.com/vidavidorra/548ffbcdae99d752da02

TypeStrong/typedoc#362

https://ellismichael.com/blog/2015/06/12/using-travis-ci-with-github-pages/

https://okitavera.me/article/github-pages-static-site-generator-and-travisci/

Others similar issue with CSP but not related to doxygen (wrong direction lead by same error message) https://stackoverflow.com/questions/45366744/refused-to-load-the-font-datafont-woff-it-violates-the-following-content/50504870

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment