【问题标题】:Ignore a /path on a GitHub pages site?忽略 GitHub 页面站点上的 /path?
【发布时间】:2017-02-27 12:20:06
【问题描述】:

我在 GitHub 页面上托管一个静态应用程序。我的应用程序结构是这样的 - 我有一些面向前端的文件,以及一些定期运行以获取前端数据的 Python 文件,但不应该面向用户:

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

如何阻止 data/ 中的所有内容在网站上公开?

【问题讨论】:

  • 你有想过这个问题吗?

标签: github path hosting github-pages


【解决方案1】:

您有两个主要选择:

选项 1: 将您的 data 目录重命名为 _data

Jekyll 会忽略以下划线开头的文件和目录。您还可以创建一个顶级 _backend 目录,然后将您的 data 目录移动到该目录中。

选项 2: 配置 Jekyll 以排除 data 目录。

您可以将exclude 设置添加到_config.yml 以告诉Jekyll 忽略您的data 目录。

来自the configuration documentation

排除

从转换中排除目录和/或文件。这些排除 是相对于网站的源目录的,不能在 源目录。

排除:[目录,文件,...]

谷歌搜索“jekyll 下划线目录”会返回大量结果,包括解释上述所有内容的结果:https://help.github.com/articles/files-that-start-with-an-underscore-are-missing/

【讨论】:

  • 非常感谢! GitHub 页面是否使用 Jekyll?我不知道,会帮助谷歌搜索:)
  • @Richard 是的,GitHub Pages 使用 Jekyll(或者至少它可以使用 Jekyll)。更多信息here.
猜你喜欢
  • 2016-07-31
  • 1970-01-01
  • 1970-01-01
  • 2019-01-09
  • 2017-02-19
  • 1970-01-01
  • 2019-11-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多