Please check this issue for details https://github.com/gohugoio/hugo/issues/5796
I think it’s a bug and need to be fixed for this case
Please don’t expect people to navigate to some other site to find the information to help you. Copy-and-pasting that info isn’t too much to ask.
Am able to reproduce this, with the below error
Error: Error building site: “C:\Hugo\Sites\condShortcodeHref\content_index.md:7:1”: failed to render shortcode “redirection-url”: failed to process shortcode: “C:\Hugo\Sites\condShortcodeHref\layouts\shortcodes\redirection-url.html:1:75”: execute of template failed: html/template:shortcodes/redirection-url.html:1:75: {{index .Params 0}} appears in an ambiguous context within a URL
The fix is to add a leading slash to the href
.
Also this can be written more concisely using with
and .Get
<a href="/{{with $.Page.Params.country}}{{.}}/{{end}}{{.Get 0}}">Click here</a>