Denver Prophit Jr.
Denver Prophit Jr.

Reputation: 164

How can I create a Jekyll variable from another in _config.yml?

I would like to create a variable for the image path in _config.yml. I have defined baseurl and want a new one called urlimg: 'baseurl+'images/' Is that syntax correct?

urlimg: baseurl.'/images/'

Upvotes: 2

Views: 283

Answers (1)

Mr. Hugo
Mr. Hugo

Reputation: 12592

My advice would be to create two variables in your config.yml, like this:

url: https://www.example.com/
baseurl: site/
imageurl: images/

And use them in your template, like this:

{{ imageurl | prepend: site.baseurl | prepend: site.url }}

Upvotes: 1

Related Questions