blob: 8f51a57fb816fabe1c9afb86dec343dbd96a93c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
{{- $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" .Permalink $fragment }}{{ end }}{{ end -}}
{{- end -}}
<a href="{{ $link | safeURL }}"
{{ with or .Title ($link | safeURL) -}}
title="{{ . }}"
{{ end }}
{{- if $isRemote -}}
data-external
rel="noopener no-referrer"
{{ end }}>{{- .Text | safeHTML -}}</a>
{{- /* This comment removes trailing newlines and white spaces. */ -}}
|