Pass site variable value in to jekyll serve?

Is there a way to specify a value for a site variable on the ‘jekyll serve’ command line? Say I have a site variable named myInfo defined in my config.yml file:

myInfo: “Some default value”

I want to be able to change that value at build/serve time without editing the config file. So I’d like to be able to use a command line like this:

jekyll serve --config=_myconfig.yml myInfo=SomeInfo

Is there a way to do this?

Hello,

I don’t know of such kind paramter syntax but you can use a second configuration file to
overrule a setting in the first you won’t edit.

$ cat _2nd_config.yml
myInfo: "Some other value"

and run:
$ jekyll serve --config _config.yml,_2nd_config.yml

Cheers

2 Likes

That is exactly what I needed; it suits my purposes perfectly.

Thanks, Floyd.
gary