Escaping colons in keyword modifiers?


(Oleg Voronin) #1

I'm trying to render a colon-containing string (a url) depending on presence of a certain metadata value. The following fails:

%globals_asset_metadata_SomeMetadataField_value^contains:SomeValue:<script type="text/javascript" src="http://example.com"></script>%

as the colon is being interpreted as a separator between "contains" and "doesn't contain" outputs. Escaping it with a slash doesn't work, neither does adding a : to the end of the replacement.


(Bart Banda) #2

Haven't had any success in putting colons into keyword modifiers but for something like the above, I usually do something like: %globals_asset_metadata_SomeMetadataField_value^contains:SomeValue: :%

So you hard code everything inside 2 keyword modifier checks and if they are not true, comment out everything inside it.


(Robin Shi) #3

In addition to Bart's reply, use relative protocol URL might be better,

%globals_asset_metadata_SomeMetadataField_value^contains:SomeValue:<script type="text/javascript" src="//example.com"></script>%