Automatically remove extra hyphens in SEO title

This commit is contained in:
Kijin Sung 2024-10-07 21:08:47 +09:00
parent fc86ae24de
commit 18fb48e457

View file

@ -773,9 +773,10 @@ class Context
}
if (count($vars))
{
$title = trim(trim(preg_replace_callback('/\\$(\w+)/', function($matches) use($vars) {
$title = trim(preg_replace_callback('/\\$(\w+)/', function($matches) use($vars) {
return isset($vars[strtolower($matches[1])]) ? $vars[strtolower($matches[1])] : $matches[0];
}, $title), ' -'));
}, $title));
$title = preg_replace('/(-\s+)+-/', '-', trim($title, ' -'));
}
self::$_instance->browser_title = $title;
}