Reputation: 6406
I have the following defined in my Jekyll config matter:
dir: a-directory/
I now want to have:
dir: a-directory/
images: {{ dir }}images/
However this won't work. One solution is to place this in my template file
{% capture images %}{{ site.dir }}images/{% endcapture %}
The variable images is now available to other points in that file. However it isn't available to any content being compiled in with that file, e.g my actual pages.
Doing {% capture site.images %}
would seem the way to sort that, but you can't assign items to the site
or page
globals outside of the _config and front matter respectively.
Is it possible to achive this kind of global variable stacking?
(please avoid solutions involving changing my directory structure; if there are similar compilers offering more features without a huge change to workflow I'm open)
Upvotes: 5
Views: 2466
Reputation: 27908
It seems YAML doesn't directly support concatenation. There are a few workarounds, though:
Upvotes: 2