Shortcode with index

I am trying to use .Get to access my Site parameters:

{{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}}”}}{{end}}

This does not work.

When I use a string constant it works:
{{else if in .Page.Permalink “xap102” }}{{index .Page.Site.Params.xap102 “***java-version”***}}{{end}}

How can I make this shortcode work by passing the argument to it and using Get?

{{index .Page.Site.Params.xap101 (.Get 0) }}

Not tested, but should work.

yup that did the trick

tks

Works great, but it also outputs a trailing blank with the string, anyway to trim that ?

Again, I am using this for a url :
Example

http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-{{%version “spring”%}}.xsd

and the result is
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1
.xsd

1 Like

I guess that’s standard behaviour from Hugo; I think that’s due to the newlines generated by Hugo (here).