如何阻止 github 页面解析 YAML

How to stop github pages from parsing YAML

我写了一个纯静态博客没有使用jekyll引擎,是纯js静态博客.

我想把我的js博客推送到github页,不幸的是它会解析YAML并得到这样的错误:

Your site is having problems building: There was a YAML syntax error on line 3 column 14 in : mapping values are not allowed in this context. For more information, see https://help.github.com/articles/page-build-failed-invalid-yaml-in-data-file.

如何阻止 github 页面解析 YAML?

如果你想禁用 jekyll,请在 github 页面 repo 的根目录添加一个空文件 .nojekyll

touch .nojekyll
git add .
git push

我通过 trial-and-error 找到了解决方案。如果你把 YML 注释放在前几行,Jekyll 不会处理它。

# 
# Comment
# 

---
- hosts: all

在我的例子中,我试图提供静态 .yml ansible 剧本,而 Jekyll 在下载文件时一直将 "{{ item.name }}" 解析为 ""