Sitemap providers

To localize the sitemap of a site, so-called "sitemap providers" are available. These are executed one after the other (depending on priority) to localize XML sitemaps according to certain criteria.

interface EliasHaeussler\Typo3Warming\Sitemap\Provider\Provider

Interface for sitemap providers used to locate the path to an XML sitemap of a given site.

get($site, $siteLanguage = null)

Locate the XML sitemaps of the given site.

Parameters
Returns

An array of instances of EliasHaeussler\Typo3Warming\Sitemap\SiteAwareSitemap.

static getPriority

Get the provider's priority. The higher the returned value, the earlier the provider will be executed in the sitemap location process.

Return type

int

Default providers

By default, the path to an XML sitemap is determined in three steps:

  1. Page type

    When using the XML sitemap from TYPO3's SEO extension, the configured path to the XML sitemap can be determined by the appropriate page type.

  2. Site configuration

    Within the Sites module, one can explicitly define the path to the XML sitemap of a site.

    Configuration of XML sitemap path within the Sites module
  3. robots.txt

    If no path is defined in the site configuration, a possible robots.txt file is parsed for a valid Sitemap specification. Read more at sitemaps.org.

    Note

    Since version 1.0.0 of EXT:warming, all sitemaps in robots.txt are captured. Prior to this version, only the first occurrence was respected.

  4. Default path

    If none of the above methods are successful, the default path sitemap.xml is used.

Implement a custom provider

To develop your own sitemap provider, it is only necessary to implement the EliasHaeussler\Typo3Warming\Sitemap\Provider\Provider interface. In addition, the getPriority() method must be used to define when the provider is executed.

The order of the providers provided by default is as follows:

Sitemap provider

Priority

EliasHaeussler\Typo3Warming\Sitemap\Provider\PageTypeProvider

300

EliasHaeussler\Typo3Warming\Sitemap\Provider\SiteProvider

200

EliasHaeussler\Typo3Warming\Sitemap\Provider\RobotsTxtProvider

100

EliasHaeussler\Typo3Warming\Sitemap\Provider\DefaultProvider

PHP_INT_MIN

Once your custom provider is ready, make sure to clear the DI caches in order to rebuild the service container properly.