2024-01-30 05:43:20 -05:00
|
|
|
{{- $u := urls.Parse .Destination -}}
|
|
|
|
{{- $href := $u.String -}}
|
2024-02-20 20:57:51 -05:00
|
|
|
{{- if strings.HasPrefix $u.String "#" }}
|
|
|
|
{{- $href = printf "%s#%s" .Page.RelPermalink $u.Fragment }}
|
|
|
|
{{- else if not $u.IsAbs -}}
|
2024-01-30 05:43:20 -05:00
|
|
|
{{- with or
|
|
|
|
($.Page.GetPage $u.Path)
|
|
|
|
($.Page.Resources.Get $u.Path)
|
|
|
|
(resources.Get $u.Path)
|
|
|
|
-}}
|
|
|
|
{{- $href = .RelPermalink -}}
|
|
|
|
{{- with $u.RawQuery -}}
|
|
|
|
{{- $href = printf "%s?%s" $href . -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- with $u.Fragment -}}
|
|
|
|
{{- $href = printf "%s#%s" $href . -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- $attributes := dict "href" $href "title" .Title -}}
|
|
|
|
<a
|
|
|
|
{{- range $k, $v := $attributes -}}
|
|
|
|
{{- if $v -}}
|
|
|
|
{{- printf " %s=%q" $k $v | safeHTMLAttr -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
>{{ .Text | safeHTML }}</a>
|
|
|
|
{{- /**/ -}}
|