Fix link whitespace

rust
Elnu 2 years ago
parent 93527a60b8
commit e26abeaa50

@ -1,5 +1,5 @@
<!-- https://github.com/bep/hugo-mod-misc/blob/79a51b35c8cd162bc9977aba0c07bd0e93f69d25/render-hooks/layouts/_default/_markup/render-link.html --> <!-- https://github.com/bep/hugo-mod-misc/blob/79a51b35c8cd162bc9977aba0c07bd0e93f69d25/render-hooks/layouts/_default/_markup/render-link.html -->
{{ $link := .Destination }} {{- $link := .Destination -}}
{{ $isRemote := strings.HasPrefix $link "http" }} {{ $isRemote := strings.HasPrefix $link "http" }}
{{- if not $isRemote -}} {{- if not $isRemote -}}
{{ $url := urls.Parse .Destination }} {{ $url := urls.Parse .Destination }}
@ -13,4 +13,4 @@
{{ end }} {{ end }}
{{ end -}} {{ end -}}
{{- end -}} {{- end -}}
<a href="{{ $link | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if $isRemote }} target="_blank"{{ end }}>{{ .Text | safeHTML }}</a> <a href="{{ $link | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if $isRemote }} target="_blank"{{ end }}>{{ .Text | safeHTML }}</a>{{ "" -}}

Loading…
Cancel
Save