Short code returning a string

I have the following shortcode:

{{ if in .Page.Permalink “97” }}/xap97/
{{else if in .Page.Permalink “100” }}/xap100/
{{else if in .Page.Permalink “101” }}/xap101/
{{else if in .Page.Permalink “102” }}/xap102/
{{else if in .Page.Permalink “110” }}/xap110/
{{else}}
{{index .Page.Site.Params “latestjavaurl”}}
{{end}}

When I display the output of this shortcode I have a trailing blank after the actual text :

example:
/xap102/

I am using this shortcode to construct an other url, I need to strip the result in order for this to work.

How can I strip the result ?

Try the trim template func:

Nop did not work.

Here is the solution:

{{ if in .Page.Permalink “xap97” }}{{"/xap97/"}}
{{ else if in .Page.Permalink “xap100” }}{{"/xap100/"}}
{{ else if in .Page.Permalink “xap101” }}{{"/xap101/"}}
{{ else if in .Page.Permalink “xap102” }}{{"/xap102/"}}
{{ else if in .Page.Permalink “xap110” }}{{"/xap110/"}}
{{ else }}{{ index .Page.Site.Params “latestjavaurl”}}{{ end }}

I was also having trouble with new lines from the template encoded to HTML and messing with my final HTML.

A fix or additional option to trim space was added

To trim the space use {{- -}}

Thanks

I have an additional similar problem … here is the code:

{{if in .Page.Permalink “xap97”}}{{index .Page.Site.Params.xap97 (.Get 0)}}
{{else if in .Page.Permalink “xap100”}}{{index .Page.Site.Params.xap100 (.Get 0)}}
{{else if in .Page.Permalink “xap101”}}{{index .Page.Site.Params.xap101 (.Get 0)}}
{{else if in .Page.Permalink “xap102”}}{{index .Page.Site.Params.xap102 (.Get 0)}}
{{else if in .Page.Permalink “xap102”}}{{index .Page.Site.Params.xap102 (.Get 0)}}
{{else if in .Page.Permalink “xap110”}}{{index .Page.Site.Params.xap110 (.Get 0)}}
{{else}}{{index .Page.Site.Params.xap120 (.Get 0)}}{{end}}

Params are in the config.toml file

All cases return a string with an additional cr/lf , only the last case returns a string with no cr/lf

Any idea ?