Sitemap providers
To locate 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 Provider
-
- Fully qualified name
-
\Elias
Haeussler\ Typo3Sitemap Locator\ 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 XML sitemaps of the given site.
- param TYPO3\CMS\Core\Site\Entity\Site $site
-
The site whose XML sitemap path should be located.
- param TYPO3\CMS\Core\Site\Entity\SiteLanguage $siteLanguage
-
An optional site language to include while locating the XML sitemap path.
- Returns
-
An array of instances of
\Elias
.Haeussler\ Typo3Sitemap Locator\ Domain\ Model\ Sitemap
Default providers
By default, the path to an XML sitemap is determined in three steps:
-
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.
-
Site configuration
Within the Sites module, one can explicitly define the path to the XML sitemap of a site.
See also
Read more at Site configuration.
-
robots.
txt If no path is defined in the site configuration, a possible
robots.
file is parsed for validtxt Sitemap
specifications. Read more at sitemaps.org. -
Default path
If none of the above methods are successful, the default path
sitemap.
is used.xml
Implement a custom provider
To develop your own sitemap provider, it is only necessary to
implement the \EliasHaeussler\Typo3SitemapLocator\Sitemap\Provider\Provider
interface. In addition, the get
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 |
---|---|
\Elias | 300 |
\Elias | 200 |
\Elias | 100 |
\Elias | PHP_ |
Once your custom provider is ready, make sure to clear the DI caches in order to rebuild the service container properly.
See also
View the sources on GitHub: