I have a shortcode that is meant to produce a call to action button for a given page. It works for a page that matches the current language, in this case PT.
For example: {{< showpage-large ref="page/iscsp-ced/index.pt.md" col="col-md-6" >}}
If the current language is PT and I try to fetch a page in the default English language, it simply doesn’t return anything.
Thank you ! That works, I added a check that the ref exists, here’s the final code:
{{ $page := "" }}
{{ range .Page.Sites }}
{{ with (.GetPage $ref) }}
{{ $page = (.GetPage $ref) }}
{{ end }}
{{ end }}
At first I tried to check if $ref and (.GetPage $ref).File matched, that would have been a better fit because it is more explicit. For some reason that method didn’t work although the output of those variables was identical in the HTML.