【发布时间】:2014-10-19 01:10:49
【问题描述】:
在我的 Jekyll _config.yml 文件中,我有:
...
test1: hello
...
在我的 index.html 文件中,我有
...
<h1>{{ site.test1 }}</h1>
...
当我的网站建成后,在 _site/index.html 中,我现在有了
...
<h1>hello</h1>
...
这是我想要做的:在我的 _config.yml 文件中:
...
test1: hello
@include _config2.yml ### this is not possible, but I'd like to do this!
...
然后,在_config2.yml:
...
test2: world
...
在 index.html 中,
...
<h1>{{ site.test1 }}, {{ site.test2 }}</h1>
...
会在 _site/index.html 中生成:
当我的网站建成后,在 _site/index.html 中,我现在有了
...
<h1>hello, world</h1>
...
我试图弄清楚如何/如果可以做到这一点,我的想法是我有一个包含数十个变量的单页网站,为了我的编辑,我希望他们分开.yml 文件。
干杯,
阿尔伯特
【问题讨论】:
-
我自己对 Jekyll 来说还很陌生,但这似乎是数据文件的完美案例。 jekyllrb.com/docs/datafiles
-
谢谢,这就是我要找的!
-
太棒了!我也发布了答案。您能否将其标记为已批准的答案以帮助未来的访客?谢谢!
标签: jekyll