How can I do string concatenation, or string replacement in YAML?

Geo picture Geo · Mar 30, 2011 · Viewed 74.3k times · Source

I have this:

user_dir: /home/user
user_pics: /home/user/pics

How could I use the user_dir for user_pics? If I have to specify other properties like this, it would not be very DRY.

Answer

Brian Wells picture Brian Wells · May 10, 2011

You can use a repeated node, like this:

user_dir: &user_home /home/user
user_pics: *user_home

I don't think you can concatenate though, so this wouldn't work:

user_dir: &user_home /home/user
user_pics: *user_home/pics