2022-05-27 01:57:49 +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>
|
2022-05-27 01:57:49 +00:00
|
|
|
{{- else -}}
|
2023-11-26 03:05:53 +00:00
|
|
|
<a href="{{ .Destination | htmlEscape }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a>
|
2022-05-27 01:57:49 +00:00
|
|
|
{{- end -}}
|