Simplify and align detection of remote links

This commit is contained in:
Alex Shpak
2025-09-21 22:29:59 +02:00
parent 79001ff6f3
commit 69fb3210e8
4 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
{{ $href := partial "docs/links/portable-link" (dict "Page" .Page "Destination" (.Get "href")) -}}
{{ $isRemote := (urls.Parse $href).Scheme}}
{{- $href := partial "docs/links/portable-link" (dict "Page" .Page "Destination" (.Get "href")) -}}
{{- $isRemote := (urls.Parse $href).IsAbs -}}
<a {{ with $href }}href="{{ $href }}"{{ end }} {{ with $isRemote }}target="_blank" rel="noopener"{{ end }} class="book-btn{{ with .Get "class" }} {{ . }}{{ end }}">
{{- .InnerDeindent -}}
</a>