Reputation: 22183
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.
Upvotes: 27
Views: 10296
Reputation: 410582
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.
Upvotes: 47