如何在Jekyll中添加前页默认值的异常?



我在_config中有一些默认的正面内容。yaml文件:

defaults:
- scope:
path: "./Articles"
values:
parent: Articles
nav_exclude: true
- scope:
path: "./Books"
values:
parent: Books
nav_exclude: true

基本上,它获取目录。/Articles和。/Books中的每个文件,并使其成为目录(github repo: https://github.com/Fr06t/reading-notes/)中索引文件的子文件。问题是,它也使索引文件成为它们自己的子文件。有没有办法豁免他们?

默认情况下,从您的目标文件中填充您的标题的空白。如果您希望索引文件具有不同的值,最简单的方法是将parent: null添加到这些文件中。

./Books/index.md:

---
parent: null
nav_exclude: false
# Existing front matter here as well
---

此空值将优先于_config.yml中的defaults。或者,您可以为这些文件添加另一个默认条目,您只需要检查它的优先级:

defaults:
- scope:
path: "./Articles/index.md"
values:
parent: null
nav_exclude: false

最新更新