Skip to content
This repository was archived by the owner on Jun 14, 2024. It is now read-only.

Commit f18a002

Browse files
fix white space around links (#93)
Fixes #45 Signed-off-by: Kapunahele Wong <kapunahelewong@gmail.com>
1 parent 2c48dcc commit f18a002

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed
Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
{{ $link := .Destination }}
2-
{{ $isRemote := strings.HasPrefix $link "http" }}
3-
{{- if not $isRemote -}}
4-
{{ $url := urls.Parse .Destination }}
5-
{{- if $url.Path -}}
6-
{{ $fragment := "" }}
7-
{{- with $url.Fragment }}{{ $fragment = printf "#%s" . }}{{ end -}}
8-
{{- if .Page.GetPage $url.Path }}{{ $link = printf "%s%s" (.Page.GetPage $url.Path).RelPermalink $fragment }}{{ end }}{{ end -}}
9-
{{- end -}}
10-
<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>
1+
{{ $link := .Destination -}}
2+
{{ $isRemote := strings.HasPrefix $link "http" -}}
3+
{{ if not $isRemote -}}
4+
{{ $url := urls.Parse .Destination -}}
5+
{{ if $url.Path -}}
6+
{{ $fragment := "" -}}
7+
{{ with $url.Fragment }}{{ $fragment = printf "#%s" . }}{{ end -}}
8+
{{ with .Page.GetPage $url.Path }}{{ $link = printf "%s%s" .RelPermalink $fragment }}{{ end -}}
9+
{{ end -}}
10+
{{ end -}}
11+
<a href="{{ $link | safeURL }}"
12+
{{- with .Title}} title="{{ . }}"{{ end -}}
13+
{{- if $isRemote }} target="_blank" rel="noopener"{{ end -}}
14+
>
15+
{{- .Text | safeHTML -}}
16+
</a>

0 commit comments

Comments
 (0)