templatesclosuresgoogle-closure-templates

Is it possible to concatenate two strings in soy (Closure Templates)?


With soy, I would like to concatenate two strings (hard-coded or variables) into one. My idea was to "parametrize" the first variable with the second:

{let $key: 'abc_$anothervariable' /}

This doesn't work. I also tried using builtin join() function for lists:

{let $key: join(['abc', $anothervariable], '') /}

But this approach doesn't work either - it even seems to have invalid syntax. Is it even possible to do something like that in Closure Templates?


Solution

  • The answer actually turned out to be as easy as:

    {let $key: 'abc_' + $anothervariable /}