Bug #86569

Respect no_index while creating canonical and hreflang tags

Added by Marc Hirdes 9 months ago. Updated about 2 months ago.

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

100%

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

Description

If the meta tag robots is set to noindex, there should be no canonical or hreflang tags linking to this page.

The following code

<meta name="robots" content="noindex,follow"/>
<link rel="alternate" hreflang="en-US" href="https://t3master.ddev.com/"/>
<link rel="alternate" hreflang="x-default" href="https://t3master.ddev.com/"/>

<link rel="canonical" href="https://t3master.ddev.com/"/>

should look like this

<meta name="robots" content="noindex,follow"/>

Furthermore it would be great if the canonical links to an internal page, that there it's also checked, if this page can be indexed. The same with hreflang.


Related issues

Duplicated by TYPO3 Core - Task #86545: Make canonical and hreflang optional Resolved 2018-10-02

Associated revisions

Revision 603b6bf1 (diff)
Added by Richard Haeser 8 months ago

[BUGFIX] Respect no_index while creating canonical and hreflang tags

When the current page is set to no_index, no canonical tag
and hreflang tags will be generated.

Resolves: #86569
Releases: master
Change-Id: I7e5360bc9159e31a4ffaa352a05ba0d8296693ed
Reviewed-on: https://review.typo3.org/58588
Tested-by: TYPO3com <>
Reviewed-by: Jörg Bösche <>
Reviewed-by: Marc Hirdes <>
Reviewed-by: Willi Wehmeier <>
Reviewed-by: Guido Schmechel <>
Tested-by: Guido Schmechel <>
Reviewed-by: Benni Mack <>
Tested-by: Benni Mack <>

History

#1 Updated by Richard Haeser 9 months ago

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

Setting a canonical to a page you don't want to index, is not that smart. But it could get messed up if you set the canonical of page 1 to page 2 and afterwards page 2 will set to noindex. Build in a check if maybe a little bit too much of a "weight" in every page call because this will not happen that often. Maybe creating a feature that will report editors they have setup wrong canonicals might be a nice feature for EXT:cs_seo or EXT:yoast_seo ;-)

Removing the canonical on a noindex page is a valid point and I will fix that. Removing the hreflang-tags I will check, because it might be that the page in the other language can be indexed I guess.

#2 Updated by Richard Haeser 9 months ago

  • Duplicated by Task #86545: Make canonical and hreflang optional added

#3 Updated by Gerrit Code Review 9 months ago

  • Status changed from Accepted 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/58588

#4 Updated by Gerrit Code Review 9 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/58588

#5 Updated by Richard Haeser 8 months ago

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

#6 Updated by Ben Robinson 7 months ago

The Patch does not remove the canonical if "robots" is set to "noindex" via TypoScript, for example:

page.meta{
    # Do not index if page gets content from other page (duplicate content)
    robots.replace = 1
    robots.override = noindex, nofollow
    robots.override.if.isTrue.field = content_from_pid
}

Should we reopen this or should i create a new issue?

#7 Updated by Benni Mack about 2 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF