Fix auto-link URLs: prevent double language prefix from relative link conversion
This commit is contained in:
@@ -579,9 +579,9 @@ class CodePressCMS {
|
|||||||
// Auto-link page titles to existing content pages (but not in H1 tags)
|
// Auto-link page titles to existing content pages (but not in H1 tags)
|
||||||
$body = $this->autoLinkPageTitles($body, $cleanName);
|
$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="\/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 [
|
return [
|
||||||
'title' => $title ?: $cleanName ?: 'Untitled',
|
'title' => $title ?: $cleanName ?: 'Untitled',
|
||||||
|
|||||||
Reference in New Issue
Block a user