Bug #86577

hreflang and canonical ignores extension parameters

Added by Marc Hirdes 12 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Must have
Category:
SEO
Start date:
2018-10-05
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

To link to a detail page via hreflang and canonical without any extension parameter must be avoided. Currently it is only possible to hook into the canonical generation. I found no way to change the hreflang. It would be great if the language menue processor adds all parameters, which are used to calculate the cHash, e.g. add $GLOBALS['TSFE']->cHash_array.


Related issues

Related to TYPO3 Core - Task #86545: Make canonical and hreflang optional Closed 2018-10-02
Related to TYPO3 Core - Feature #86847: addQueryString for languageMenuProcessor Closed 2018-11-04
Related to TYPO3 Core - Feature #87128: Add acceptance test concerning canonicalized URL creation Under Review 2018-12-11
Duplicated by TYPO3 Core - Bug #86866: Hreflang tags for pages with extension records not correct Closed 2018-11-06
Duplicated by TYPO3 Core - Bug #86865: Canonical tag for pages with extension records not correct Closed 2018-11-06

Associated revisions

Revision 9988b62b (diff)
Added by Richard Haeser 9 months ago

[BUGFIX] Respect GET parameters when generating canonicalized URLs

Add current query string to the generated canonicalized URL to make the
hreflang and canonical work with additional parameters as well.

Parameters that are excluded from cache hash generation and not included
in $GLOBALS['TYPO3_CONF_VARS']['FE']['additionalCanonicalizedUrlParameters'],
are excluded from the canonicalized URL.

Resolves: #86577
Resolves: #86866
Resolves: #86865
Releases: master
Change-Id: Ib574e2f6c7aa869b4ffa798c7122a60f4cf13f13
Reviewed-on: https://review.typo3.org/58611
Tested-by: Joerg Kummer <>
Tested-by: TYPO3com <>
Reviewed-by: Joerg Kummer <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

History

#1 Updated by Richard Haeser 11 months ago

  • Status changed from New to Needs Feedback

I see the issue with the language menu processor indeed. As far as I can see, you can't add the addQueryString option. But do you have issues with canonical as well? Because that is already adding the current query string.

#2 Updated by Christian Knauf 11 months ago

Richard Haeser wrote:

I see the issue with the language menu processor indeed. As far as I can see, you can't add the addQueryString option. But do you have issues with canonical as well? Because that is already adding the current query string.

Have an extension provided with a routeEnhancers, but the Canonical tag on the detail pages does not change and displays the Canonical tag of the page, where the extension is included.

.....
routeEnhancers:
Suffix:
type: PageType
default: ''
map:
sitemap.xml: 1533906435
Location Plugin:
type: Extbase
limitToPages:
- 5
extension: Amlocations
plugin: Locations
routes:
-
routePath: '/ location / {location_title}'
_controller: 'Location :: show'
_arguments:
location_title: location
defaultController: 'Location :: show'
aspects:
location_title:
type: PersistedAliasMapper
tableName: tx_amlocations_domain_model_location
routeFieldName: path_segment

.....

#3 Updated by Richard Haeser 11 months ago

  • Related to Task #86545: Make canonical and hreflang optional added

#4 Updated by Richard Haeser 11 months ago

  • Status changed from Needs Feedback to Accepted
  • Assignee set to Richard Haeser
  • Target version set to Candidate for patchlevel

#5 Updated by Marc Hirdes 11 months ago

Until this not works and also otherwise, it would be great to provide a hook for the hreflang.

#6 Updated by Richard Haeser 11 months ago

  • Status changed from Accepted to In Progress

#7 Updated by Richard Haeser 11 months ago

The canonical is only not created correctly when route enhancers are set

#8 Updated by Gerrit Code Review 11 months ago

  • Status changed from In Progress 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/58611

#9 Updated by Ben Robinson 11 months ago

I would like to test the patch. Is there already an extension available for 9 LTS that supports route enhancers and has a list and detail view?

#10 Updated by Marc Hirdes 11 months ago

To use addQueryString is maybe not a good idea. It would be better to add all params, that are used to generate the cHash. They are stored in the $GLOBALS['TSFE']->cHash_array. Maybe you like to take a look here https://github.com/clickstorm/cs_seo/issues/171

#11 Updated by Ben Robinson 11 months ago

I do not exactly know yet how to properly test the patch, therefore one question:
Does the LanguageMenuProcessor used in the patch check if there is a translation for the record?

Imagine the following:

1. List view:
Default language: www.domain.com/news
Translation: www.domain.de/news
This is easy, since there are no Get-Parameters. It just needs to be checked if the translation for this page exists.

2. List view, page 2
Default language: www.domain.com/news/page/2
It must be checked if this "list view page 2" is available in the translation.
If it is not available, the hreflang for this language needs to be skipped

3. Detail view
Default language: www.domain.com/news/id/25
It must be checked if there is a translation for item 25.
If it is not available, the hreflang for this language needs to be skipped

#12 Updated by Gerrit Code Review 10 months 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/58611

#13 Updated by Gerrit Code Review 10 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#14 Updated by Richard Haeser 10 months ago

  • Duplicated by Bug #86866: Hreflang tags for pages with extension records not correct added

#15 Updated by Richard Haeser 10 months ago

  • Duplicated by Bug #86865: Canonical tag for pages with extension records not correct added

#16 Updated by Richard Haeser 10 months ago

  • Related to Feature #86847: addQueryString for languageMenuProcessor added

#17 Updated by Gerrit Code Review 10 months ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#18 Updated by Gerrit Code Review 10 months ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#19 Updated by Gerrit Code Review 10 months ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#20 Updated by Gerrit Code Review 9 months ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#21 Updated by Gerrit Code Review 9 months ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#22 Updated by Gerrit Code Review 9 months ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#23 Updated by Gerrit Code Review 9 months ago

Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#24 Updated by Gerrit Code Review 9 months ago

Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#25 Updated by Gerrit Code Review 9 months ago

Patch set 12 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#26 Updated by Gerrit Code Review 9 months ago

Patch set 13 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#27 Updated by Gerrit Code Review 9 months ago

Patch set 14 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#28 Updated by Gerrit Code Review 9 months ago

Patch set 15 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#29 Updated by Gerrit Code Review 9 months ago

Patch set 16 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#30 Updated by Gerrit Code Review 9 months ago

Patch set 17 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#31 Updated by Gerrit Code Review 9 months ago

Patch set 18 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#32 Updated by Gerrit Code Review 9 months ago

Patch set 19 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#33 Updated by Gerrit Code Review 9 months ago

Patch set 20 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#34 Updated by Gerrit Code Review 9 months ago

Patch set 21 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58611

#35 Updated by Richard Haeser 9 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#36 Updated by Steffen Dietrich 9 months ago

  • Related to Feature #87128: Add acceptance test concerning canonicalized URL creation added

#37 Updated by Benni Mack 4 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF