mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
31 lines
1012 B
HTML
31 lines
1012 B
HTML
{{/* From Hugo, Apache v2 license
|
|
https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_markup/render-link.html
|
|
*/}}
|
|
{{- $u := urls.Parse .Destination -}}
|
|
{{- $href := $u.String -}}
|
|
{{- if strings.HasPrefix $u.String "#" -}}
|
|
{{- $href = printf "%s#%s" .PageInner.RelPermalink $u.Fragment -}}
|
|
{{- else if and $href (not $u.IsAbs) -}}
|
|
{{- $path := strings.TrimPrefix "./" $u.Path -}}
|
|
{{- with or
|
|
($.PageInner.GetPage $path)
|
|
($.PageInner.Resources.Get $path)
|
|
(resources.Get $path)
|
|
-}}
|
|
{{- $href = .RelPermalink -}}
|
|
{{- with $u.RawQuery -}}
|
|
{{- $href = printf "%s?%s" $href . -}}
|
|
{{- end -}}
|
|
{{- with $u.Fragment -}}
|
|
{{- $href = printf "%s#%s" $href . -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
|
|
<a href="{{ $href }}" {{ with .Title }}title="{{ . }}"{{ end }}
|
|
{{- if or (strings.HasPrefix .Destination "http:") (strings.HasPrefix .Destination "https:") }} target="_blank"{{ end }}>
|
|
{{- .Text | safeHTML -}}
|
|
</a>
|
|
{{- /* Trim EOF */ -}}
|