From 19a543289bf4d6e6980aedbdc27d12bacb77efc6 Mon Sep 17 00:00:00 2001 From: James Elliott Date: Tue, 28 Jun 2022 10:52:06 +1000 Subject: [PATCH] docs: remove link whitespace (#3612) --- .../layouts/_default/_markup/render-link.html | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/docs/layouts/_default/_markup/render-link.html b/docs/layouts/_default/_markup/render-link.html index 27913267..92f01703 100644 --- a/docs/layouts/_default/_markup/render-link.html +++ b/docs/layouts/_default/_markup/render-link.html @@ -1,11 +1,16 @@ -{{ $link := .Destination -}} -{{ $isRemote := strings.HasPrefix $link "http" -}} -{{ if not $isRemote -}} -{{ $url := urls.Parse .Destination -}} -{{ if $url.Path -}} -{{ $fragment := "" -}} -{{ with $url.Fragment }}{{ $fragment = printf "#%s" . }}{{ end -}} -{{ with .Page.GetPage $url.Path }}{{ $link = printf "%s%s" .RelPermalink $fragment }}{{ end }}{{ end -}} -{{ end -}} +{{- $link := .Destination }} +{{- $isRemote := strings.HasPrefix $link "http" }} +{{- if not $isRemote }} + {{- $url := urls.Parse .Destination }} + {{- if $url.Path }} + {{- $fragment := "" }} + {{- with $url.Fragment }} + {{ $fragment = printf "#%s" . }} + {{- end }} + {{- with .Page.GetPage $url.Path }} + {{- $link = printf "%s%s" .RelPermalink $fragment }} + {{- end }} + {{- end }} +{{- end -}} {{ .Text | safeHTML }} {{- /* This comment removes trailing newlines. */ -}}