You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
628 B
HTML
11 lines
628 B
HTML
{{$trimmed := strings.TrimSuffix ".md" (.Destination | safeURL)}}
|
|
{{$dashedurl := replace $trimmed "%20" "-" }}
|
|
{{$external := strings.HasPrefix $dashedurl "http" }}
|
|
{{- if $external -}}
|
|
<a href="{{ $dashedurl }}" rel="noopener">{{ .Text | safeHTML }}</a>
|
|
{{- else -}}
|
|
{{$spacedurl := replace $trimmed "%20" " " }}
|
|
{{$fixedUrl := (cond (hasPrefix $spacedurl "/") $spacedurl (print "/" $spacedurl)) | urlize}}
|
|
{{$rooted := default $spacedurl (strings.TrimRight "/" (.Page.GetPage $spacedurl).RelPermalink) }}
|
|
<a href="{{$rooted}}" rel="noopener" class="internal-link" data-src="{{$rooted}}">{{ .Text | safeHTML }}</a>
|
|
{{- end -}} |