diff --git a/docs/layouts/_default/_markup/render-link.html b/docs/layouts/_default/_markup/render-link.html new file mode 100644 index 0000000000..89d0b0d33d --- /dev/null +++ b/docs/layouts/_default/_markup/render-link.html @@ -0,0 +1,13 @@ +{{- if or (strings.HasPrefix .Destination "http") (strings.HasPrefix .Destination "#") -}} +{{ .Text | safeHTML }} +{{- else -}} +{{- $link := . -}} +{{- $internal := urls.Parse .Destination -}} +{{- if $internal.Path -}} +{{- $fragment := "" }} +{{- with $internal.Fragment }}{{ $fragment = printf "#%s" . }}{{ end -}} +{{- with .Page.GetPage $internal.Path }}{{ $internal = printf "%s%s" .RelPermalink $fragment }} +{{ $link.Text | safeHTML }} +{{- end -}} +{{- end -}} +{{- end -}}