Skip to content

Commit d9e4b29

Browse files
committed
Set canonicalURL in AbstractListViewPage
Closes #6477
1 parent b812cc5 commit d9e4b29

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

wcfsetup/install/files/lib/page/AbstractListViewPage.class.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ public function readParameters()
5151
if (isset($_REQUEST['filters']) && \is_array($_REQUEST['filters'])) {
5252
$this->filters = $_REQUEST['filters'];
5353
}
54+
55+
$this->canonicalURL = $this->getCanonicalUrl();
5456
}
5557

5658
#[\Override]
@@ -139,21 +141,19 @@ protected function getHeadContent(): string
139141
);
140142
}
141143

142-
$linkTags[] = \sprintf(
143-
'<link rel="canonical" href="%s">',
144-
StringUtil::encodeHTML(
145-
LinkHandler::getInstance()->getControllerLink(static::class, \array_merge(
146-
$this->getBaseUrlParameters(),
147-
[
148-
'pageNo' => $this->listView->getPageNo() !== 1 ? $this->listView->getPageNo() : null,
149-
]
150-
))
151-
)
152-
);
153-
154144
return \implode("\n", $linkTags);
155145
}
156146

147+
protected function getCanonicalUrl(): string
148+
{
149+
return LinkHandler::getInstance()->getControllerLink(static::class, \array_merge(
150+
$this->getBaseUrlParameters(),
151+
[
152+
'pageNo' => $this->pageNo !== 1 ? $this->pageNo : null,
153+
]
154+
));
155+
}
156+
157157
/**
158158
* Returns the list view instance for the rendering of this page.
159159
*

0 commit comments

Comments
 (0)