2014-10-19 31 views
1

在我的傑奇_config.yml文件,我有:在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中文件。

乾杯,

阿爾伯特

+1

在相當新的哲基爾自己,但是這似乎是一個數據文件,一個完美的案例。 http://jekyllrb.com/docs/datafiles/ – trnelson 2014-10-19 01:33:22

+1

謝謝,那就是我一直在尋找的! – alberto56 2014-10-19 02:01:59

+0

太棒了!我也作爲答覆發佈。您能否將其標記爲幫助未來訪客的核準答案?謝謝! – trnelson 2014-10-19 03:44:00

回答

相關問題