I’m trying to call a Hugo function within an HTML attribute. The function I’m calling is strings.TrimRight which needs two arguments enclosed within quotes. My code looks something like this:
<a href="{{ strings.TrimRight (.Permalink) "/" }}"></a>
I want to remove the last / from .Permalink. How would it be possible?
Did you try to escape the quotes like
<a href="{{ strings.TrimRight (.Permalink) \"/\" }}"></a>
Not tested, just an idea.
Hope this helps.
Escape sequences don’t work.
Hmmmm, that‘s not good. Did you try single quotes either for href or inside for the expression? I mean the combination of quotes and single quotes.
regis
April 22, 2018, 12:12pm
5
@kaushalmodi recently taught me that back quotes are supported in Hugo. You should try those.
2 Likes
@regis Yes, using back quotes worked.
1 Like
Just to close the loop, that example of using backquotes is now live here .