I need .Permalink value to not contains dot, space, hashtag, dollar sign, [ or ].
and I do nested replace, like bellow:
{{ replace (replace (replace (replace (replace .RelPermalink "." "-") "[" "-") "]" "-") "$" "-") "#" "-" }}
is it okay? I am new to hugo. Thank you.
razon
2
You can use the replaceRE
function instead, for example:
{{ replaceRE `[\s\.\$\[\]#]` "-" "a b.c[d$e]f#g" }}
a-b-c-d-e-f-g
1 Like
system
Closed
4
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.