I need to set the href
value depending on the nullity of sling:vanityPath
. The hit.properties.sling:vanityPath
returns the string value for sling:vanityPath
property. I need to append a /
before the hit.properties.sling:vanityPath
value. Is it possible to do that in the following code or do I have to test it twice, but that comes with code repetition?
<a href="${hit.properties.sling:vanityPath == null? hit.path : hit.properties.sling:vanityPath @ extension='html'}"/>
Concatenation or binary operators are not supported in HTL. You can either use prependPath or double test for the slash.