From 2bb0a945b6e5b332d2177d55f6af07162e257578 Mon Sep 17 00:00:00 2001
From: Simon Hollingshead <me@simonhollingshead.com>
Date: Thu, 06 Apr 2023 23:41:24 +0000
Subject: [PATCH] Be stricter about what counts as an external link. (#794)

---
 layouts/_default/_markup/render-link.html |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html
index 5417731..0b13cd2 100644
--- a/layouts/_default/_markup/render-link.html
+++ b/layouts/_default/_markup/render-link.html
@@ -1 +1 @@
-<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }} {{ if strings.HasPrefix .Destination "http" }} class="external-link" target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a>
\ No newline at end of file
+<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }} {{ if findRE "^(https?:)?//" (lower .Destination) }} class="external-link" target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a>
\ No newline at end of file

--
Gitblit v1.10.0