From 56751f4744b12b2db8e6d4fe5640c12ad8ba7ec1 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Thu, 7 Nov 2024 10:50:25 -0500 Subject: [PATCH] Fix link paths in apidocs shortcode --- layouts/shortcodes/apidocs.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/layouts/shortcodes/apidocs.md b/layouts/shortcodes/apidocs.md index 2040ae24efeb..a3b6c964e073 100644 --- a/layouts/shortcodes/apidocs.md +++ b/layouts/shortcodes/apidocs.md @@ -1,15 +1,15 @@ -{{ $pages := slice }} +{{ $pages := slice -}} {{ range $key,$value := $.Site.Data.instrumentation -}} {{ if eq $key "dotnet" -}} {{ with $.Site.GetPage "/docs/languages/net/traces-api" -}} - {{ $pages = $pages | append (dict "lang" $value "page" .) }} + {{ $pages = $pages | append (dict "lang" $value "page" .) -}} {{ end }} {{ with $.Site.GetPage "/docs/languages/net/metrics-api" -}} - {{ $pages = $pages | append (dict "lang" $value "page" .) }} + {{ $pages = $pages | append (dict "lang" $value "page" .) -}} {{ end }} {{ else -}} {{ with $.Site.GetPage (printf "/docs/languages/%s/api" $key) -}} - {{ $pages = $pages | append (dict "lang" $value "page" .) }} + {{ $pages = $pages | append (dict "lang" $value "page" .) -}} {{ end }} {{ end -}} {{ end -}} @@ -17,11 +17,14 @@ {{ range $pages }} {{ $title := replaceRE `API reference` "" .page.Title -}} -- [ +- {{/* Encode the link directly as an anchor to avoid unnecessary render-link hook checks */ -}} + {{- .lang.name -}} {{ with $title }} — {{ . }} {{- end -}} - ]( - {{- .page.Permalink -}} - ) + {{- end -}}