Project

General

Profile

Actions

Bug #91353

closed

Epic #89797: HrefLang / Canonical issues

Deactivation of Hreflang Tags not possible anymore

Added by Benjamin Robinson almost 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Category:
SEO
Target version:
-
Start date:
2020-05-09
Due date:
% Done:

100%

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

Description

It should be possible to deactivate the generation of the hreflang tags via ...

unset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\CMS\Frontend\Page\PageGenerator']['generateMetaTags']['hreflang']);

... as described in the manual , but it does not (10.4.1).

I have tried whether disabling the canonical via the similar …

unset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\CMS\Frontend\Page\PageGenerator']['generateMetaTags']['canonical']);
… still works: yes, it does.

It looks like ...
TYPO3_CONF_VARS > SC_OPTIONS > TYPO3\CMS\Frontend\Page\PageGenerator > generateMetaTags > hreflang
… it is out of date. I can't even find it in the configuration module.

Background of the problem:
I created a language in the sites module whose content is not yet finished. This language version should be accessible to some people involved and who know the link, but for now there should not be an <link rel="alternate" hreflang="lang_code" href="url_of_page"/> entry. If I deactivate "Visible in Frontend", it unfortunately cannot be accessed at all, not even via the view-module in the backend:
Page Not Found The page did not exist or was inaccessible. Reason: Page is not available in the requested language
Therefore I thought it would be the easiest workaround to deactivate the complete hreflang-tag generation.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #93188: Possibility to disable hreflang per pageClosedRichard Haeser2020-12-30

Actions
Actions #1

Updated by Georg Ringer almost 4 years ago

  • Category changed from Link Handling, Site Handling & Routing to SEO
  • Assignee set to Richard Haeser
Actions #2

Updated by Benjamin Robinson almost 4 years ago

Addendum: my suggestion would be to set up a checkbox "exclude from hreflang" in the site management for the languages. That way you could control this specifically for individual languages and you don't have to deactivate a language completely if it is still under construction on the one hand, but on the other hand should be made available to decision makers without BE access. The global unset for hreflang would then also no longer be absolutely necessary.

What I also don't like about a complete deactivation of a language: if for each language a separate domain is used and a language is hidden for the time being, then you only have a preview if you are logged in at the same time under the same domain in the BE. If you call the domain by mistake without being logged into the BE, a 404 is created. If the error handling is set to "show content from page", then the 404 content is also not accessible and an error entry is created in the log.

Actions #3

Updated by Oliver Bartsch almost 4 years ago

The Hook was replaced by an PSR-14 Event. See: #86614

So there is no possibility to generally unset the generation. What you could do now is register an own listener which is executed after and unset the HrefLang tags.

However the documentation should be updated for this case.

Actions #4

Updated by Benjamin Robinson over 3 years ago

I think that, apart from the above example, there may still be other cases where it is necessary to deactivate the hreflang. For example, if you have a news module with a page browser that goes over 10 pages in one language but only 5 in another. So far the hreflang of page 10 would lead to a non-existent page 10 of the other language. So it would be better to deactivate it and it would be nice if this could even be done via TypoScript:


[request.getQueryParams()['tx_news_pi1']['widget_0']['currentPage'] && request.getQueryParams()['tx_news_pi1']['widget_0']['currentPage'] > 0]
    page.config.hreflang = 0
[global]

(page.config.hreflang = 0 was suggested by Christoph at https://forge.typo3.org/issues/88242#note-5 )

So even an integrator could deactivate it, because the hook is rather something for developers.

Actions #5

Updated by Georg Ringer over 3 years ago

  • Related to Epic #89797: HrefLang / Canonical issues added
Actions #6

Updated by Richard Haeser over 3 years ago

  • Parent task set to #89797
Actions #7

Updated by Gerrit Code Review over 3 years ago

  • Status changed from New 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/+/67315

Actions #8

Updated by Richard Haeser over 3 years ago

For now I updated the docs (see review), but I also created https://forge.typo3.org/issues/93188 to work on a more easy way to disable the rendering of those tags.

Actions #9

Updated by Gerrit Code Review over 3 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/+/67315

Actions #10

Updated by Gerrit Code Review over 3 years 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/c/Packages/TYPO3.CMS/+/67315

Actions #11

Updated by Gerrit Code Review over 3 years ago

Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67294

Actions #12

Updated by Richard Haeser over 3 years ago

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

Updated by Richard Haeser over 3 years ago

  • Status changed from Resolved to Closed
Actions #14

Updated by Georg Ringer about 3 years ago

  • Related to Feature #93188: Possibility to disable hreflang per page added
Actions

Also available in: Atom PDF