忽略GitHub页面网站上的/path? [英] Ignore a /path on a GitHub pages site?
问题描述
我在GitHub页面上托管了一个静态应用程序.我的应用程序结构是这样的-我有一些面向前端的文件,还有一些Python文件,这些文件会定期运行以获取前端的数据,但不应面向用户:
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
如何阻止data/
中的所有内容在网站上公开提供?
How can I stop everything in data/
being publicly available on the website?
推荐答案
您有两个主要选择:
选项1:将您的data
目录重命名为_data
.
Option 1: Rename your data
directory to _data
.
Jekyll忽略以下划线开头的文件和目录.您还可以创建一个顶级_backend
目录,然后将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.
选项2:.将Jekyll配置为排除data
目录.
Option 2: Configure your Jekyll to exclude the data
directory.
您可以在_config.yml
中添加exclude
设置,以告诉Jekyll忽略您的data
目录.
You can add an exclude
setting to _config.yml
to tell Jekyll to ignore your data
directory.
来自配置文档:
排除
从转换中排除目录和/或文件.这些排除 相对于网站的源目录,不能在 源目录.
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.
排除:[DIR,FILE ...]
exclude: [DIR, FILE, ...]
使用谷歌搜索"jekyll下划线目录"会返回大量结果,其中包括解释以上所有内容的结果:
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/
这篇关于忽略GitHub页面网站上的/path?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!