Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以在 config.yml 文件中设置配置值并将它们打印在 Jekyll 的 HTML 页面中?我想在 config.yml 文件中设置我的网站的默认标题和描述,并将它们打印在我所有布局的标题中。
每个模板都有一个site变量,其中包含来自_config.yml. 例如,如果您有类似my_setting: "string"in 的_config.yml内容,则可以使用 访问模板中的值{{ site.my_setting }}。
site
_config.yml
my_setting: "string"
{{ site.my_setting }}
注意:如果您使用的是jekyll serve,则需要重新启动该过程才能进行更改。确实,_config.yml没有重新加载手表选项。
jekyll serve