Ignore a /path on a GitHub pages site?

断了今生、忘了曾经 提交于 2020-02-21 04:57:07

问题


I am hosting a static application on GitHub pages. My application structure is like this - I have some front-end facing files, and some Python files that are run periodically to get the data for the front-end, but should not be user-facing:

index.html
/js
    index.js
    vendor/
/css
/data
    get_data.py

How can I stop everything in data/ being publicly available on the website?


回答1:


You have two main options:

Option 1: Rename your data directory to _data.

Jekyll ignores files and directories that start with an underscore. You could also create a top-level _backend directory and then move your data directory into that.

Option 2: Configure your Jekyll to exclude the data directory.

You can add an exclude setting to _config.yml to tell Jekyll to ignore your data directory.

From the configuration documentation:

Exclude

Exclude directories and/or files from the conversion. These exclusions are relative to the site's source directory and cannot be outside the source directory.

exclude: [DIR, FILE, ...]

Googling "jekyll underscore directory" returns a ton of results, including this one which explains all of the above: https://help.github.com/articles/files-that-start-with-an-underscore-are-missing/



来源:https://stackoverflow.com/questions/40104627/ignore-a-path-on-a-github-pages-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!