From 2244fcbee2550213ef11ba1b76d2e08d133bc98b Mon Sep 17 00:00:00 2001 From: Edwin Noorlander Date: Tue, 21 Jul 2026 13:00:24 +0200 Subject: [PATCH] Fix auto-link URLs: prevent double language prefix from relative link conversion --- cms/core/class/CodePressCMS.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cms/core/class/CodePressCMS.php b/cms/core/class/CodePressCMS.php index 7ca4b7e..557be0e 100644 --- a/cms/core/class/CodePressCMS.php +++ b/cms/core/class/CodePressCMS.php @@ -579,9 +579,9 @@ class CodePressCMS { // Auto-link page titles to existing content pages (but not in H1 tags) $body = $this->autoLinkPageTitles($body, $cleanName); - // Convert relative internal links to clean URLs + // Convert relative internal links to clean URLs (skip already-prefixed URLs) $body = preg_replace('/href="\/blog\/([^"]+)"/', 'href="/' . $this->currentLanguage . '/blog/$1"', $body); - $body = preg_replace('/href="\/([^"]+)"/', 'href="/' . $this->currentLanguage . '/$1"', $body); + $body = preg_replace('/href="\/(?!nl\/|en\/|nl"|en")([^"]+)"/', 'href="/' . $this->currentLanguage . '/$1"', $body); return [ 'title' => $title ?: $cleanName ?: 'Untitled',