Jekyll 配置多个文件

Jekyll Config Multiple Files

正如doc提到的,我们应该能够写:

jekyll build --config "_config.yml, _config.en.yml"

相反,我收到:

Fatal: The configuration file ' _config.en.yml' could not be found.

虽然文件实际存在。

我做错了什么?

这是一个逗号分隔的列表。您用逗号和 space.

分隔它

把逗号后面的space去掉

jekyll build --config "_config.yml,_config.en.yml"

对于来到这里但没有找到他们需要的答案的其他人:

也可能是您 运行 来自配置文件所在的另一个文件夹的构建脚本(如 git post-receive 挂钩)

在这种情况下,您需要调整示例脚本以包含 $CONFIG,如下所示:

TMP_GIT_CLONE=$HOME/tmp_git/your_domain
GEMFILE=$TMP_GIT_CLONE/Gemfile  
PUBLIC_WWW=/var/www/html/your_domain
CONFIG=$TMP_GIT_CLONE/_config.yml,$TMP_GIT_CLONE/_config_dev.yml  
git clone $GIT_REPO $TMP_GIT_CLONE
BUNDLE_GEMFILE=$GEMFILE bundle install
BUNDLE_GEMFILE=$GEMFILE bundle exec jekyll build -s $TMP_GIT_CLONE -d $PUBLIC_WWW --config $CONFIG