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 $excludedQuerystringParameters

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

Methods

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

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.

Details

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

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 $excludedQuerystringParameters

the list of query string parameters to be excluded 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