Project

General

Profile

Actions

Bug #87760

closed

Epic #89797: HrefLang / Canonical issues

Option to remove params from canonical tag

Added by Patrick Fiedorowicz about 5 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
SEO
Target version:
-
Start date:
2019-02-21
Due date:
% Done:

0%

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

Description

I have a page with news plugin and pagination.
Each pagination url and also the canonical tag looks like:
- example.com/news/2/
- example.com/news/3/
- example.com/news/.../

Currently there is no possibility to remove the tx_news_pi1[@widget_0][currentPage] param from the canonical tag.

I've tested the behaviour with and without RouteEnhancers, no changes.

The CanonicalGenerator uses a function "getParamsToExcludeForCanonicalizedUrl" in "TYPO3\CMS\Frontend\Utility\CanonicalizationUtility" to determine which params should be removed from the canonical tag.
But at the moment this only removes params wich should be ignored for chash calculation - but this is no solution for pagination widget.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #88242: Make canonical optionalClosed2019-04-28

Actions
Actions #1

Updated by Richard Haeser about 5 years ago

  • Status changed from New to Needs Feedback

Why do you want to remove the page parameter? Paginated pages shouldn’t have a canocial to the first page and that is what happens when you remove the parameter.

See https://yoast.com/pagination-seo-best-practices/ for more information

Actions #2

Updated by Patrick Fiedorowicz about 5 years ago

Richard Haeser wrote:

Why do you want to remove the page parameter? Paginated pages shouldn’t have a canocial to the first page and that is what happens when you remove the parameter.

You are right, Google said that the canonical tag should also include paginated pages.
But most seo tools complain about duplicate titles of the news list and paginated pages. So I would prefer to remove them from canonical tag.

But I can give you another example:
If you use news with categories (article can be related to multiple categories) and use them for filtering, you have to remove the category parameter from canonical tag to prevent duplicate content.

Actions #3

Updated by Richard Haeser about 5 years ago

  • Status changed from Needs Feedback to New
Actions #4

Updated by Christoph Hendreich almost 5 years ago

Actions #5

Updated by Lidia Demin over 4 years ago

Example use case, where parameters shouldn't be added to canonical tag

There is an element that displays individually share-able content blocks. Therefore parameters are attached to the page url the content block is displayed on. If such a content block is shared, the og-tags fetched from the parametric url contain information of the content block and not of the page it's on, but the canonical tag should be the same as the target page still displays the same content.

Example code:

<f:for each="{ContentBlocks}" as="ContentBlock">
   <div id="content-block-1">
      <!-- content block content here -->
      <a href="https://www.facebook.com/sharer/sharer.php?u={f:uri.action(
          pluginName: 'ContentBlockSlider',
          controller: 'ContentBlock',
          action: 'ContentBlockSlider',
          arguments: '{contentBlock: contentBlock}', absolute: 1
       )}">Share me</a>
   </div>
</f:for>

The controller action then overrides the according meta tags. if a $contentBlock argument was provided.

There were several use cases where we had to use this approach to share different contents on one page.

Actions #6

Updated by Richard Haeser over 4 years ago

  • Parent task set to #89797
Actions #7

Updated by Richard Haeser over 4 years ago

  • Status changed from New to Closed

For both cases you could use the hook in TYPO3 v9 or the PSR-14 event ModifyUrlForCanonicalTagEvent in v10.2+

You can add your own logic and set the canonical link you want. Be aware that the canonical is using all relevant parameters that are used for cHash calculation as well. If a parameter is not necessary for a canonical url, you also might want to check if it is necessary for cHash calculation.

Actions #8

Updated by Matthias Kappenberg over 1 year ago

Try to add your get Vars to:

$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters']

list, worked in my case (v10 and v11).

Actions

Also available in: Atom PDF