class SitemapGenerator (View source)

Class to be used to generate the elements to be included in a sitemap.xml file.

Properties

protected Application $app
protected Repository $config
protected string $customSiteCanonicalUrl
private PageListGenerator|null $pageListGenerator
private ResolverManagerInterface|null $resolverManager
private PageKey|null|false $sitemapChangeFrequencyAttributeKey
private PageKey|null|false $sitemapPriorityAttributeKey
private string|false $defaultChangeFrequency
private string|false $defaultPriority

Methods

__construct(Application $app, Repository $config)

Initialize the instance.

$this;
setPageListGenerator(PageListGenerator $pageListGenerator)

No description

$this;
setResolverManager(ResolverManagerInterface $resolverManager)

No description

string
getSiteCanonicalUrl()

Get the currently configured canonical URL of the site.

string
getCustomSiteCanonicalUrl()

Get the custom canonical URL for the site.

$this
setCustomSiteCanonicalUrl(string $customSiteCanonicalUrl)

Set the custom canonical URL for the site.

URLInterface
resolveUrl(array $args)

Resolve an URL using the custom site canonical URL (if set).

PageKey|null
string
getDefaultChangeFrequency()

No description

string
getDefaultPriority()

No description

URLInterface
getPageUrl(Page $page)

No description

string
getPageChangeFrequency(Page $page)

No description

string
getPagePriority(Page $page)

No description

createSitemapPage(Page $page, bool $multilingualEnabled)

No description

populateLanguageAlternatives(SitemapPage $sitemapPage)

No description

withCustomCanonicalUrl(callable $run)

Don't use with generators!

Details

__construct(Application $app, Repository $config)

Initialize the instance.

Parameters

Application $app
Repository $config

PageListGenerator getPageListGenerator()

Return Value

PageListGenerator

$this; setPageListGenerator(PageListGenerator $pageListGenerator)

Parameters

PageListGenerator $pageListGenerator

Return Value

$this;

ResolverManagerInterface getResolverManager()

$this; setResolverManager(ResolverManagerInterface $resolverManager)

Parameters

ResolverManagerInterface $resolverManager

Return Value

$this;

SitemapElement[]|Generator generateContents()

Return Value

SitemapElement[]|Generator

string getSiteCanonicalUrl()

Get the currently configured canonical URL of the site.

Return Value

string

string getCustomSiteCanonicalUrl()

Get the custom canonical URL for the site.

Return Value

string

$this setCustomSiteCanonicalUrl(string $customSiteCanonicalUrl)

Set the custom canonical URL for the site.

Parameters

string $customSiteCanonicalUrl

Return Value

$this

URLInterface resolveUrl(array $args)

Resolve an URL using the custom site canonical URL (if set).

Parameters

array $args

Return Value

URLInterface

protected PageKey|null getSitemapChangeFrequencyAttributeKey()

Return Value

PageKey|null

protected PageKey|null getSitemapPriorityAttributeKey()

Return Value

PageKey|null

protected string getDefaultChangeFrequency()

Return Value

string

protected string getDefaultPriority()

Return Value

string

protected URLInterface getPageUrl(Page $page)

Parameters

Page $page

Return Value

URLInterface

protected string getPageChangeFrequency(Page $page)

Parameters

Page $page

Return Value

string

protected string getPagePriority(Page $page)

Parameters

Page $page

Return Value

string

protected SitemapPage createSitemapPage(Page $page, bool $multilingualEnabled)

Parameters

Page $page
bool $multilingualEnabled

Return Value

SitemapPage

protected populateLanguageAlternatives(SitemapPage $sitemapPage)

Parameters

SitemapPage $sitemapPage

protected withCustomCanonicalUrl(callable $run)

Don't use with generators!

Parameters

callable $run