Install the gem:
gem install jekyll-environment-variables
And then add it to your _config.yml
:
plugins: # "gems" before Jekyll 3.5
- jekyll-environment-variables
Alternatively, you can use Bundler with Gemfile
:
group :jekyll_plugins do
gem 'jekyll-environment-variables'
end
Then run bundle install
and let Bundler handle it for you.
All environment variables will be copied to site.env
for use in Liquid templates.
Hostname: {{ site.env.HOSTNAME }}
My home: {{ site.env.HOME }}