I have a VERY simply shortcode, “productname.html”, that refers to a config parameter:
{{.Site.Params.productname}}
When I write content containing “{{<productname>}}'s the best” the rendered HTML includes a trailing newline, which results in unwanted whitespace before my apostrophe. eg: Super Product 's the best
I have a work-around, but it’s very silly. I extend the shortcut so that it understands parameters,
{{.Site.Params.productname}}{{ if .Get 0}}{{index .Params 0}}{{ end }}
… and now I can write content like: “{{<productname> "'s"}} the best”
Is there any way around this? Alternatively, is there a smarter way to make config parameters appear in content?
Thank you for the pointer. I’m not sure this is expected behaviour, given practically every text editor on earth puts an EOL marker of some kind at the end of a line, but that’s fine. I can work around it.
Tantalising! Sadly, my search skills apparently are not up to the task. I can’t find any reference to defining a template enddelimiter (or end delimiter!)
If its the last case, then there is no newline generated, all other cases produce a newline.
If I put the entire statement on one line it does not produce any newlines.
In order to maintain my code I would like to keep it in the above form.
I haven’t tested it, and am no Hugo expert, but I don’t see any evidence that you have tried the -}} syntax as discussed in this topic. Maybe give that a go