class SeoCanonical (View source)

Helper class to work with SEO canonical URLs.

Properties

protected ResolverManagerInterface $resolver

The instance of the class that builds page URLs.

protected Numbers $valn

The instance of the numbers validator.

protected string[]|Traversable $includedQuerystringParameters

The list of query string parameters to be included from generated canonical URLs.

protected string[] $pathArguments

The list of path arguments to be included in canonical URLs.

Methods

__construct(ResolverManagerInterface $resolver, Numbers $valn, string[]|Traversable $includedQuerystringParameters)

Initialize the instance.

URLInterface|null
getPageCanonicalURL(Page|int $page, Request|ParameterBag|Query|array|string|null $querystring = null)

Generate the canonical URL of a page.

Element|null
getPageCanonicalURLTag(Page|int $page, Request|ParameterBag|Query|array|string|null $querystring = null)

Generate the tag of a page.

string[]|null
getPathArguments()

Get path arguments to append canonical URLs

setPathArguments(string[] $pathArguments)

Set path arguments to append canonical URLs

void
addIncludedQuerystringParameter(string $parameter)

No description

array

Details

__construct(ResolverManagerInterface $resolver, Numbers $valn, string[]|Traversable $includedQuerystringParameters)

Initialize the instance.

Parameters

ResolverManagerInterface $resolver

the instance of the class that builds page URLs

Numbers $valn

the instance of the numbers validator

string[]|Traversable $includedQuerystringParameters

the list of query string parameters to be included from generated canonical URLs

URLInterface|null getPageCanonicalURL(Page|int $page, Request|ParameterBag|Query|array|string|null $querystring = null)

Generate the canonical URL of a page.

Parameters

Page|int $page

The Page instance (or its collection ID)

Request|ParameterBag|Query|array|string|null $querystring

Optional query string parameters

Return Value

URLInterface|null

Element|null getPageCanonicalURLTag(Page|int $page, Request|ParameterBag|Query|array|string|null $querystring = null)

Generate the tag of a page.

Parameters

Page|int $page

The Page instance (or its collection ID)

Request|ParameterBag|Query|array|string|null $querystring

Optional query string parameters

Return Value

Element|null

string[]|null getPathArguments()

Get path arguments to append canonical URLs

Return Value

string[]|null

setPathArguments(string[] $pathArguments)

Set path arguments to append canonical URLs

Parameters

string[] $pathArguments

void addIncludedQuerystringParameter(string $parameter)

Since: 9.0.3

No description

Parameters

string $parameter

Return Value

void

array getIncludedQuerystringParameters()

Since: 9.2.X

No description

Return Value

array