SSJS and keywords


(Gjboyd7) #1

Is it possible to use keywords in SSJS

For example in a content container within the Default Format of an asset listing or a calendar events search page…

<script runat="server">
  print('tester: %asset_name%');
</script>

Does not print anything!

Is SSJS limited to just Global keywords?


(Gjboyd7) #2

Well - my mistake - you can use keywords with SSJS - in my case there was just a character in one of the asset names which needed to be escaped.

<script runat="server">
  print('tester: %asset_name^escapequotes%');
</script>

(Bart Banda) #3

Yep. Also have a look at https://matrix.squiz.net/manuals/concepts/chapters/server-side-javascript#processing-order to understand when certain keywords get evaluated.