Commit 111b47c9 authored by Richard Haeser's avatar Richard Haeser
Browse files

[DOCS] Add hint how to alter or remove hreflang tags

In some edge cases you may want to disable or change the rendering of
the hreflang tags. We added some hints how to deal with such cases.

Resolves: #91353
Releases: master, 10.4
Change-Id: Id9ea8a0206cd9df1522d790c2cad93e2ab41afbb
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/67315

Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Tymoteusz Motylewski's avatarTymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarMartin Kutschker <mkutschker-typo3@yahoo.com>
Tested-by: Richard Haeser's avatarRichard Haeser <richard@richardhaeser.com>
Reviewed-by: Tymoteusz Motylewski's avatarTymoteusz Motylewski <t.motylewski@gmail.com>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarMartin Kutschker <mkutschker-typo3@yahoo.com>
Reviewed-by: Richard Haeser's avatarRichard Haeser <richard@richardhaeser.com>
parent 6450b0f5
......@@ -114,12 +114,15 @@ Hreflang Tags
The generation of the :html:`<link rel="alternate" hreflang="" href="" />`
tags is done automatically if the page is available in other languages.
This feature should work correctly in almost all cases.
If you have a specific edge case, and you don't want TYPO3 to render those tags, you can disable rendering of the those tags completely.
You just have to put this line in the :file:`ext_localconf.php` of an extension and make sure your extension is loaded after EXT:seo.
.. code-block:: php
TYPO3 is using PSR-14 events to handle the generation of those hreflang tags.
If, for some reason, you would like to alter or remove the automatically generated
tags, you can register your own EventListener. This EventListener should listen
to the :php:`TYPO3\CMS\Frontend\Event\ModifyHrefLangTagsEvent` event. Just make
sure your EventListener is ordered after the :php:`TYPO3\CMS\Seo\HrefLang\HrefLangGenerator`
listener.
unset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\CMS\Frontend\Page\PageGenerator']['generateMetaTags']['hreflang']);
More information how to work with EventListeners can be found in the documentation of :ref:`t3coreapi:EventDispatcher`
.. _config-canonical-tag:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment