我正在使用GitHub页面在Jekyll网站上工作,并发现 {% include myinclude.html %}
液体在_includes和_layout文件中工作得很好 . 但是,当向_config.yml添加元素(例如 author : myusername
)并尝试在 _layouts/default.html
或 _includes/myinclude.html
中将它们用作 {{ site.author }}
时,生成的文本只是空白 . 要注意,这些更改未提交或推送,我正在使用Linux子系统上安装的本地jekyll实例 .
在我的实际页面中_includes和_layout之外,网站变量工作得很好 . 为什么不显示网站变量?目前,我必须将实际值放回页面 .
2 回答
以上是预期的行为, every change to _config.yml needs the development server to be restarted to process new settings .
source
假设对
_config.yml
的编辑会自动更新,正如Jekyll对其他文件的编辑所做的那样,我没有重新启动我最初启动的jekyll实例 . 只需关闭Jekyll实例并重新启动它,在我的情况下使用bundle exec jekyll serve
,阅读更新的配置文件,{{ site.variables }}
出现并按照我的预期正确显示 .对
_config.yml
的任何更改都需要重新启动Jekyll实例 .