From 2eb97d7fe7dafe519056d7df9bb5f013cce69d8c Mon Sep 17 00:00:00 2001
From: David Karlsson <35727626+dvdksn@users.noreply.github.com>
Date: Fri, 29 Sep 2023 21:06:55 +0200
Subject: [PATCH] fix: use links with leading slash as-is
Links that started with a slash were being prepended the URL hostname
and rendered as absolute links before. This caused our link checker to
miss broken links that contained a leading slash.
This change fixes this issue by rendering links with a leading slash as-is,
without modification.
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
---
layouts/_default/_markup/render-link.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html
index e47b46f4e9..c3208e8616 100644
--- a/layouts/_default/_markup/render-link.html
+++ b/layouts/_default/_markup/render-link.html
@@ -12,8 +12,8 @@
>
{{- else if (strings.HasPrefix $url "/") -}}
- {{/* absolute link, use absURL */}}
- {{ .Text | safeHTML }}
+ {{/* absolute link, use url as-is */}}
+ {{ .Text | safeHTML }}
{{- else -}}
{{/* check if the file links to index.md */}}
{{- if (strings.FindRE `([^_]|^)index.md` $url 1) -}}