Reputation: 21842
There are multiple sets of configuration which you may want to execute when you are running the site locally while when your site is running on server (say Github).
I have defined similar set of configuration in my _config.yml
file like this
title: Requestly
locale: en_US
description: Chrome Extension to modify HTTP(s) Requests
logo: site-logo.png
search: true
env: dev
config:
dev:
url: http://localhost:4000
prod:
url: http://requestly.github.io/blog
url: site.config[site.env].url // Does not work
I have used {{ site.url }}
everywhere else in my templates, layouts and
posts.
How can I define site.url
in my _config.yml
file whose value depends upon the config
and env
defined in the same file.
PS: I know one of the ways is to change {{ site.url }}
to {{ site.config[site.env].url }}
in all the files. That should probably work.
I just want to know how to use variables in _config.yml
. Is that even possible ?
Upvotes: 3
Views: 2363
Reputation: 55
Yes you can with Jekyll 3.8.0 or later version now. Please give that a try
Upvotes: 0
Reputation: 52799
No you cannot use variables in a _config file.
You can find more informations here : Change site.url to localhost during jekyll local development
Upvotes: 2