From 97607c3ca5ac837f7f6bc7a048b72a8271fbd570 Mon Sep 17 00:00:00 2001 From: benbohmer <103453816+benbohmer@users.noreply.github.com> Date: Tue, 3 May 2022 09:10:45 +0200 Subject: [PATCH] fix: keep / at end of URL to avoid redirects Removed strings.TrimRight "/" in line 10 to keep the trailing slash at the end of URLs in regular links. This avoids having every single internal link being a 301 redirect. --- layouts/_default/_markup/render-link.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html index cdacfc134..4757b7284 100644 --- a/layouts/_default/_markup/render-link.html +++ b/layouts/_default/_markup/render-link.html @@ -7,7 +7,7 @@ {{$spacedurl := replace $trimmed "%20" " " }} {{$fixedUrl := (cond (hasPrefix $spacedurl "/") $spacedurl (print "/" $spacedurl)) | urlize}} {{$nonexistent := eq (.Page.GetPage $spacedurl).RelPermalink ""}} -{{$rooted := default $spacedurl (strings.TrimRight "/" (.Page.GetPage $spacedurl).RelPermalink) }} +{{$rooted := default $spacedurl ((.Page.GetPage $spacedurl).RelPermalink) }}