Feature #88242
closedMake canonical optional
100%
Description
It would be useful to have a TypoScript option which deactivates the generation of the canonical tag or to remove some paramter, like a fixed pagetype.
For example, when using an AMP template using pagetype, AMP output page must have the canonical to the HTML main page.
<link rel="canonical" href="https://www.domain.de/de/page-de/"/>
<link rel="alternate" hreflang="de" href="https://www.domain.de/de/page-de"/>
<link rel="alternate" hreflang="en" href="https://www.domain.de/en/page-en"/>
<link rel="alternate" hreflang="x-default" href="https://www.domain.de/de/page-de/"/>
<link rel="amphtml" href="https://www.domain.de/de/page-de/amp/" />
Alternative with subdomain <link rel="amphtml" href="https://amp.domain.de/de/page-de/" />
https://amp.dev/documentation/examples/guides/internationalization/?format=websites#example-1-canonical-amp
Every AMP document must have a link tag with rel=canonical pointing to its matching canonical desktop document, again, in the same language.
Updated by Christoph Hendreich almost 5 years ago
- Related to Task #86545: Make canonical and hreflang optional added
Updated by Christoph Hendreich almost 5 years ago
- Related to Bug #87760: Option to remove params from canonical tag added
Updated by Richard Haeser almost 5 years ago
The chash configuration is used to determine which parameters are used when rendering the link. So all parameters that are relevant to calculate the cHash are kept in generating the url. All other parameters are dropped.
There is a signal slot available where you have the possibility to set the canonical link yourself. You can use the signalName `beforeGeneratingCanonical` for the class `\TYPO3\CMS\Seo\Canonical\CanonicalGenerator`. In that way you can set your own canonical tag and can create the canonical without the type.
I think you can use that for your usecase.
Updated by Richard Haeser almost 5 years ago
- Tracker changed from Task to Feature
- Status changed from New to Needs Feedback
- Priority changed from Must have to Could have
- Target version deleted (
next-patchlevel)
Updated by Christoph Hendreich almost 5 years ago
Many thanks for the information, we have already implemented this.
In this case we noticed that the canonical and the language data were different.
Example:
<link rel="canonical" href="https://www.domain.de/de/page/amp/">
<link rel="alternate" hreflang="de" href="https://www.domain.de/de/page/">
<link rel="alternate" hreflang="en" href="https://www.domain.de/de/page/">
<link rel="alternate" hreflang="x-default" href="https://www.domain.de/de/page/">
If so, should everything run the same for both parameters?
I think it would make sense anyway to present a way to disable this directly via TS.
Thus there are still further possibilities of the adjustment directly over Pagetype in the TS.
Because a canonical can also be rendered and output via VHS and an on and off switch would be the most efficient here, I think.
page.config {
canonical = 0
hreflang = 0
}
Updated by Peter Linzenkirchner over 4 years ago
I would strongly support the solution with typoscript. I am updating an number of old TYPO3 installations end ends up with many duplicate canonicals.
Updated by Gerrit Code Review over 4 years ago
- Status changed from Needs Feedback to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62122
Updated by Gerrit Code Review over 4 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62122
Updated by Gerrit Code Review over 4 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62069
Updated by Richard Haeser over 4 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset b594b0aae937c54e7335905de3f85e8e758d03f6.