Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll use config.yml values in the HTML

Tags:

jekyll

Is it possible to setup configuration values within the config.yml file and have them be printed within the HTML page within Jekyll? I would like to set the default title and description of my website within the config.yml file and have them printed out in the header of all my layouts.

like image 518
matsko Avatar asked Aug 21 '12 20:08

matsko


1 Answers

Every template has a site variable, which contains the settings from _config.yml. For example, if you have something like my_setting: "string" in _config.yml, you can access the value in a template using {{ site.my_setting }}.

Note: if you are using jekyll serve, you will need to restart the process for changes to take place. Indeed, _config.yml is not reloaded with the watch option.

like image 133
mipadi Avatar answered Oct 07 '22 09:10

mipadi