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 "#" }}
|
2024-04-11 11:46:18 -04:00
|
|
|
{{- $href = printf "%s#%s" .PageInner.RelPermalink $u.Fragment }}
|
2024-02-20 20:57:51 -05:00
|
|
|
{{- else if not $u.IsAbs -}}
|
2024-01-30 05:43:20 -05:00
|
|
|
{{- with or
|
2024-04-11 11:46:18 -04:00
|
|
|
($.PageInner.GetPage $u.Path)
|
|
|
|
($.PageInner.Resources.Get $u.Path)
|
2024-01-30 05:43:20 -05:00
|
|
|
(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 -}}
|
2024-04-22 04:56:02 -04:00
|
|
|
{{- $attributes := dict "href" $href "title" (.Title | transform.HTMLEscape) -}}
|
2024-01-30 05:43:20 -05:00
|
|
|
<a
|
|
|
|
{{- range $k, $v := $attributes -}}
|
|
|
|
{{- if $v -}}
|
|
|
|
{{- printf " %s=%q" $k $v | safeHTMLAttr -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
>{{ .Text | safeHTML }}</a>
|
|
|
|
{{- /**/ -}}
|