From 0aa7c16ab5ff34447b97eb7b90c9f3454fb5cfa4 Mon Sep 17 00:00:00 2001 From: s-kawamura-w664 Date: Tue, 14 Jun 2022 05:49:06 +0000 Subject: [PATCH] Fix api-reference shortcode for localized pages. --- layouts/shortcodes/api-reference.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/layouts/shortcodes/api-reference.html b/layouts/shortcodes/api-reference.html index 785044dc17..90590ba52d 100644 --- a/layouts/shortcodes/api-reference.html +++ b/layouts/shortcodes/api-reference.html @@ -2,6 +2,8 @@ {{ $pageArg := .Get "page" }} {{ $anchorArg := .Get "anchor" }} {{ $textArg := .Get "text" }} -{{ $page := site.GetPage "page" (printf "%s/%s" $base $pageArg) }} +{{ $pagePath := path.Join $base $pageArg }} +{{ $page := site.GetPage "page" $pagePath }} +{{ with $page }}{{else}}{{ range where site.Home.AllTranslations "Language.Lang" "en" }}{{ $page = .Site.GetPage "page" $pagePath }}{{ end }}{{ end }} {{ $metadata := $page.Params.api_metadata }} {{if $textArg}}{{ $textArg }}{{else if $anchorArg}}{{ $anchorArg }}{{else}}{{ $metadata.kind }}{{end}} \ No newline at end of file