1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 04:38:27 +01:00

Fixes #4994 - Canonical URL domain should always be the same.

This commit is contained in:
Cameron 2023-04-17 15:06:00 -07:00
parent c3517641e0
commit 14f5142c66

View File

@ -4052,8 +4052,16 @@ class e107
$url = self::url($plugin, $key, $row, $options); $url = self::url($plugin, $key, $row, $options);
} }
if(!empty($url)) if(!empty($url))
{ {
$siteurl = self::getPref('siteurl');
if(!empty($siteurl) && $siteurl !== '/') // ensure that duplicate parked domains always use the primary site URL. @see issue #4994
{
$url = str_replace(SITEURL, $siteurl, $url);
}
self::getJs()->addLink(array('rel'=>"canonical", "href" => $url)); self::getJs()->addLink(array('rel'=>"canonical", "href" => $url));
self::meta('og:url', $url); self::meta('og:url', $url);
self::meta('twitter:url', $url); self::meta('twitter:url', $url);