Skip to content

Commit 9dfa389

Browse files
authored
Fix link paths in apidocs shortcode (#5550)
1 parent 0ebfad0 commit 9dfa389

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

layouts/shortcodes/apidocs.md

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
1-
{{ $pages := slice }}
1+
{{ $pages := slice -}}
22
{{ range $key,$value := $.Site.Data.instrumentation -}}
33
{{ if eq $key "dotnet" -}}
44
{{ with $.Site.GetPage "/docs/languages/net/traces-api" -}}
5-
{{ $pages = $pages | append (dict "lang" $value "page" .) }}
5+
{{ $pages = $pages | append (dict "lang" $value "page" .) -}}
66
{{ end }}
77
{{ with $.Site.GetPage "/docs/languages/net/metrics-api" -}}
8-
{{ $pages = $pages | append (dict "lang" $value "page" .) }}
8+
{{ $pages = $pages | append (dict "lang" $value "page" .) -}}
99
{{ end }}
1010
{{ else -}}
1111
{{ with $.Site.GetPage (printf "/docs/languages/%s/api" $key) -}}
12-
{{ $pages = $pages | append (dict "lang" $value "page" .) }}
12+
{{ $pages = $pages | append (dict "lang" $value "page" .) -}}
1313
{{ end }}
1414
{{ end -}}
1515
{{ end -}}
1616

1717
{{ range $pages }}
1818
{{ $title := replaceRE `API reference` "" .page.Title -}}
1919

20-
- [
20+
- {{/* Encode the link directly as an <a> anchor to avoid unnecessary render-link hook checks */ -}}
21+
<a href="{{ .page.RelPermalink }}"
22+
{{- if and .page.Params.redirect (hasPrefix .page.Params.redirect "http") }} {{/* */ -}}
23+
target="_blank" rel="noopener" class="external-link"
24+
{{- end -}}
25+
>
2126
{{- .lang.name -}}
2227
{{ with $title }} &mdash; {{ . }} {{- end -}}
23-
](
24-
{{- .page.Permalink -}}
25-
)
28+
</a>
2629

2730
{{- end -}}

0 commit comments

Comments
 (0)