🛠 fix: Space in rendered link

pull/813/head
Tomy Hsieh 2024-02-22 21:36:43 -05:00
parent 94feae3cca
commit 0a6267c171
No known key found for this signature in database
GPG Key ID: 4E6AF0EEDD2205F8
1 changed files with 3 additions and 4 deletions

View File

@ -1,9 +1,9 @@
{{- $link := .Destination -}}
{{- $isRemote := strings.HasPrefix $link "http" -}}
{{- if not $isRemote }}
{{ $url := urls.Parse .Destination }}
{{- $url := urls.Parse .Destination -}}
{{- if $url.Path }}
{{ $fragment := "" }}
{{- $fragment := "" }}
{{- with $url.Fragment }}{{ $fragment = printf "#%s" . }}{{ end -}}
{{- with .Page.GetPage $url.Path }}
{{ $link = printf "%s%s" .RelPermalink $fragment }}
@ -14,5 +14,4 @@
{{ end -}}
{{ end -}}
{{ end -}}
<!-- prettier-ignore -->
<a href="{{ $link | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if $isRemote }} target="_blank" rel="noreferrer"{{ end }}>{{- .Text | safeHTML -}}</a>
<!-- prettier-ignore --><a href="{{ $link | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if $isRemote }} target="_blank" rel="noreferrer"{{ end }}>{{- .Text | safeHTML -}}</a>