ModifyHrefLangTagsEvent

final class \TYPO3\CMS\Frontend\Event\ModifyHrefLangTagsEvent

Listeners to this Event will be able to modify the hreflang tags that will be generated. You can use this when you have an edge case language scenario and need to alter the default hreflang tags.

Table of Contents

Methods

__construct()  : mixed
addHrefLang()  : void
Add a hreflang tag to the current list of hreflang tags
getHrefLangs()  : array
getRequest()  : ServerRequestInterface
setHrefLangs()  : void
Set the hreflangs. This should be an array in format::

Methods

__construct()

public __construct(ServerRequestInterface $request) : mixed

Parameters

$request : ServerRequestInterface

addHrefLang()

Add a hreflang tag to the current list of hreflang tags

public addHrefLang(string $languageCode, string $url) : void

Parameters

$languageCode : string

The language of the hreflang tag you would like to add. For example: nl-NL

$url : string

The URL of the translation. For example: https://example.com/nl

getHrefLangs()

public getHrefLangs() : array

Return values

array

getRequest()

public getRequest() : ServerRequestInterface

Return values

ServerRequestInterface

setHrefLangs()

Set the hreflangs. This should be an array in format::

public setHrefLangs(array $hrefLangs) : void

[ 'en-US' => 'https://example.com', 'nl-NL' => 'https://example.com/nl' ]

Parameters

$hrefLangs : array
On this page