EdikoyoWiki/layouts/_default/_markup/render-link.html

20 lines
608 B
HTML
Raw Normal View History

2024-09-07 08:52:05 +00:00
{{- $url := urls.Parse .Destination -}}
{{- $scheme := $url.Scheme -}}
<a href="
{{- if eq $scheme "" -}}
{{- $cleanedPath := strings.Replace $url.Path "\\" "/" -1 -}}
{{- if strings.HasSuffix $cleanedPath ".md" -}}
{{- relref .Page $cleanedPath | safeURL -}}
{{- else -}}
{{- $cleanedPath | safeURL -}}
{{- end -}}
{{- else -}}
{{- .Destination | safeURL -}}
{{- end -}}"
{{- with .Title }} title="{{ . | safeHTML }}"{{- end -}}>
{{- .Text | safeHTML -}}
</a>
{{- /* whitespace stripped here to avoid trailing newline in rendered result caused by file EOL */ -}}