4

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)

M1ke
  • 6,166
  • 4
  • 32
  • 50

1 Answers1

1

It seems YAML doesn't directly support concatenation. There are a few workarounds, though:

Community
  • 1
  • 1
C. Augusto Proiete
  • 24,684
  • 2
  • 63
  • 91