Fix auto-link URLs: prevent double language prefix from relative link conversion

This commit is contained in:
2026-07-21 13:00:24 +02:00
parent 064e905f31
commit 2244fcbee2
+2 -2
View File
@@ -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',