Skip to content

Commit

Permalink
Bugfix for ethercreative#469 that was introduced iin 4.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
niektenhoopen committed Jul 29, 2024
1 parent c96405a commit 839f0ff
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/models/data/SeoData.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,14 @@ public function getExpiry ()
*/
public function getCanonical ()
{
if (empty($this->advanced['canonical']))
return UrlHelper::siteUrl(Craft::$app->request->getFullPath());

if (empty($this->advanced['canonical'])) {
$fullPathWithPagination = Craft::$app->request->getFullPath();
$pathInfo = Craft::$app->request->getPathInfo();
return ($subPath = strpos($fullPathWithPagination, $pathInfo . '/')) === false ?
UrlHelper::siteUrl($pathInfo) :
UrlHelper::siteUrl(substr($fullPathWithPagination, $subPath));
}

return UrlHelper::siteUrl($this->advanced['canonical']);
}

Expand Down

0 comments on commit 839f0ff

Please sign in to comment.