From 35a4fd83ef76cd8dbe7fe6ca5fcb4725ee754383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Fri, 9 Jun 2023 11:11:00 +0200 Subject: [PATCH] alias: fix redirect URLs in case of empty BaseURL #562 --- layouts/alias.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/layouts/alias.html b/layouts/alias.html index e63cc4bdea..2b3db29811 100644 --- a/layouts/alias.html +++ b/layouts/alias.html @@ -1,7 +1,11 @@ - {{- $url := replace (replace .Permalink site.BaseURL "/") "//" "/" }} + {{- $url := .Permalink }} + {{- if site.BaseURL }} + {{- $url = replace .Permalink site.BaseURL "/" }} + {{- end }} + {{- $url = replace $url "//" "/" }} {{- with site.Home.GetPage $url }} {{- $c := "" }}{{/* if defaultContentLanguageInSubdir=false we are ending here for home page of the default language */}} {{- $url = partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}