2 declare(strict_types = 1);
63 $this->pageRepository = GeneralUtility::makeInstance(PageRepository::class);
74 $this->signalSlotDispatcher->dispatch(self::class,
'beforeGeneratingCanonical', [&$href]);
76 if (empty($href) && (
int)$this->typoScriptFrontendController->page[
'no_index'] === 1) {
94 $canonical =
'<link ' . GeneralUtility::implodeAttributes([
98 $this->typoScriptFrontendController->additionalHeaderData[] = $canonical;
109 if (!empty($this->typoScriptFrontendController->page[
'canonical_link'])) {
110 return $this->typoScriptFrontendController->cObj->typoLink_URL([
111 'parameter' => $this->typoScriptFrontendController->page[
'canonical_link'],
112 'forceAbsoluteUrl' =>
true,
123 if (!empty($this->typoScriptFrontendController->page[
'content_from_pid'])) {
124 $parameter = (int)$this->typoScriptFrontendController->page[
'content_from_pid'];
125 if ($parameter > 0) {
126 $targetPage = $this->pageRepository->getPage($parameter,
true);
127 if (!empty($targetPage[
'canonical_link'])) {
128 $parameter = $targetPage[
'canonical_link'];
130 return $this->typoScriptFrontendController->cObj->typoLink_URL([
131 'parameter' => $parameter,
132 'forceAbsoluteUrl' =>
true,
144 return $this->typoScriptFrontendController->cObj->typoLink_URL([
145 'parameter' => $this->typoScriptFrontendController->id .
',' . $this->typoScriptFrontendController->type,
146 'forceAbsoluteUrl' =>
true,
147 'addQueryString' =>
true,
148 'addQueryString.' => [
150 'exclude' => implode(
153 (
int)$this->typoScriptFrontendController->id,
154 (array)
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'additionalCanonicalizedUrlParameters']