2021-06-14 22:31:08 +00:00
|
|
|
{{- $parsedDest := urls.Parse (.Destination | absURL) -}}
|
2023-11-26 03:05:53 +00:00
|
|
|
{{- if (strings.HasPrefix .Destination "#") -}}
|
|
|
|
<a href="{{ .Destination }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a>
|
|
|
|
{{- else if not (strings.HasPrefix .Destination $parsedDest.Scheme) -}}
|
|
|
|
{{- $baseURL := trim .Page.Site.BaseURL "/" -}}
|
|
|
|
{{- $fragment := "" -}}
|
|
|
|
{{- with $parsedDest.Fragment -}}{{- $fragment = printf "#%s" . -}}{{- end -}}
|
|
|
|
{{- $href := printf "%s%s%s" $baseURL $parsedDest.Path $fragment | absURL -}}
|
|
|
|
<a href="{{ $href }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a>
|
2021-06-14 22:31:08 +00:00
|
|
|
{{- else -}}
|
2023-11-26 03:05:53 +00:00
|
|
|
<a href="{{ .Destination }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a>
|
2021-06-14 22:31:08 +00:00
|
|
|
{{- end -}}
|