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-05-17 18:41:18 -04:00
|
|
|
{{- $path := strings.TrimPrefix "./" $u.Path }}
|
2024-01-30 05:43:20 -05:00
|
|
|
{{- with or
|
2024-05-17 18:41:18 -04:00
|
|
|
($.PageInner.GetPage $path)
|
|
|
|
($.PageInner.Resources.Get $path)
|
|
|
|
(resources.Get $path)
|
2024-01-30 05:43:20 -05:00
|
|
|
-}}
|
|
|
|
{{- $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 -}}
|
2024-08-31 11:25:15 -04:00
|
|
|
>{{ .Text }}</a>
|
2024-01-30 05:43:20 -05:00
|
|
|
{{- /**/ -}}
|