| 1 |
{{- $u := urls.Parse .Destination -}} |
| 2 |
{{- $href := $u.String -}} |
| 3 |
{{- if strings.HasPrefix $u.String "#" -}} |
| 4 |
{{- $href = printf "%s#%s" .PageInner.RelPermalink $u.Fragment -}} |
| 5 |
{{- else if and $href (not $u.IsAbs) -}} |
| 6 |
{{- $path := strings.TrimPrefix "./" $u.Path -}} |
| 7 |
{{- with or |
| 8 |
($.PageInner.GetPage $path) |
| 9 |
($.PageInner.Resources.Get $path) |
| 10 |
(resources.Get $path) |
| 11 |
-}} |
| 12 |
{{- $href = .RelPermalink -}} |
| 13 |
{{- with $u.RawQuery -}} |
| 14 |
{{- $href = printf "%s?%s" $href . -}} |
| 15 |
{{- end -}} |
| 16 |
{{- with $u.Fragment -}} |
| 17 |
{{- $href = printf "%s#%s" $href . -}} |
| 18 |
{{- end -}} |
| 19 |
{{- end -}} |
| 20 |
{{- end -}} |
| 21 |
<a href="{{ $href }}" {{- with .Title }} title="{{ . }}" {{- end }}>{{ .Text }}</a> |
| 22 |
{{- /**/ -}} |