From 09524cac3d73e09d01271eda50ada97f5cf8633b Mon Sep 17 00:00:00 2001 From: Kapunahele Wong <kapunahelewong@gmail.com> Date: Mon, 26 Jul 2021 09:44:55 -0400 Subject: [PATCH] fix white space around links --- layouts/_default/_markup/render-link.html | 26 ++++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html index 39e6f69..51d0830 100644 --- a/layouts/_default/_markup/render-link.html +++ b/layouts/_default/_markup/render-link.html @@ -1,10 +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 -}} -{{- if .Page.GetPage $url.Path }}{{ $link = printf "%s%s" (.Page.GetPage $url.Path).RelPermalink $fragment }}{{ end }}{{ end -}} -{{- end -}} -<a href="{{ $link | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if $isRemote }} target="_blank"{{ end }}>{{- .Text | safeHTML -}}{{ if $isRemote }} <sup><i class="fas fa-external-link-alt"></i></sup>{{ end }}</a> +{{ $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 -}} +<a href="{{ $link | safeURL }}" + {{- with .Title}} title="{{ . }}"{{ end -}} + {{- if $isRemote }} target="_blank" rel="noopener"{{ end -}} +> +{{- .Text | safeHTML -}} +</a>