Skip to content

Commit 0aa7c16

Browse files
Fix api-reference shortcode for localized pages.
1 parent 8f7748c commit 0aa7c16

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

layouts/shortcodes/api-reference.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
{{ $pageArg := .Get "page" }}
33
{{ $anchorArg := .Get "anchor" }}
44
{{ $textArg := .Get "text" }}
5-
{{ $page := site.GetPage "page" (printf "%s/%s" $base $pageArg) }}
5+
{{ $pagePath := path.Join $base $pageArg }}
6+
{{ $page := site.GetPage "page" $pagePath }}
7+
{{ with $page }}{{else}}{{ range where site.Home.AllTranslations "Language.Lang" "en" }}{{ $page = .Site.GetPage "page" $pagePath }}{{ end }}{{ end }}
68
{{ $metadata := $page.Params.api_metadata }}
79
<a href="{{ $page.RelPermalink }}{{if $anchorArg}}#{{ $anchorArg }}{{end}}">{{if $textArg}}{{ $textArg }}{{else if $anchorArg}}{{ $anchorArg }}{{else}}{{ $metadata.kind }}{{end}}</a>

0 commit comments

Comments
 (0)