Remove noreferrer for external links. Remove open in new tab for external links

This commit is contained in:
SafEight 2022-11-21 21:54:48 +01:00
parent 3db6448229
commit 3852d4637b

View File

@ -1,7 +1,7 @@
{{$dashedurl := replace .Destination "%20" "-" }} {{$dashedurl := replace .Destination "%20" "-" }}
{{$external := strings.HasPrefix $dashedurl "http" }} {{$external := strings.HasPrefix $dashedurl "http" }}
{{- if $external -}} {{- if $external -}}
<a href="{{ $dashedurl }}" target="_blank" rel="noopener noreferrer">{{ .Text | safeHTML }}</a> <a href="{{ $dashedurl }}" rel="noopener">{{ .Text | safeHTML }}</a>
{{- else -}} {{- else -}}
{{$trimmed := strings.TrimSuffix ".md" (.Destination | safeURL)}} {{$trimmed := strings.TrimSuffix ".md" (.Destination | safeURL)}}
{{$spacedurl := replace $trimmed "%20" " " }} {{$spacedurl := replace $trimmed "%20" " " }}