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?
It is recommended to do any data manipulation in back end. Null check/equality check can be performed at sightly level. Amending a value based on some condition has to happen in back end and expose it in sightly via getter.