I’m trying to manipulate a URL in a variable but can’t for the life of me make it work.
The value of $myURL is ‘/file.jpg’. I’m trying to remove the ‘/’
I’ve tried:
{{ ( trim $myURL.RelPermalink “/”) }}
{{ ($myURL.RelPermalink strings.LeftTrim 0) }}
Can I do this? The docs only give examples of string manipulation where the string is an explicit input, not a variable…
zwbetz
2
Just tested. This works for me:
{{ trim .RelPermalink "/" }}
1 Like
Thanks zwbetz, but where’s the variable?
zwbetz
4
In that example, it’s a page variable. For your case, you need to show how your variable is created and what’s in it.
Edit: Also, are you getting an error? Or does it run and the trim doesn’t happen?
2 Likes
Brilliant - that does it.
{{ trim $myURL.RelPermalink "/" }}
Thanks so much for your help. What a great forum!