---
title: "XML sitemap"
manual: "TYPO3 Explained"
version: "main"
permalink: "https://docs.typo3.org/permalink/t3coreapi:xmlsitemap@main"
source: "ApiOverview/Seo/XmlSitemap.rst"
modified: "2026-09-14T11:10:56+00:00"
---

# XML sitemap

It is possible to generate XML sitemaps for SEO purposes without using 3rd party
plugins. When this feature is enabled, a sitemap index file is created with one
or more sitemaps in it. By default, there will be one sitemap that contains all
pages of the current site and language.  You can render different sitemaps
for each site and language.

> [!NOTE]
> The XML sitemap is provided by the optional system extension
> EXT:seo. You can find information about how to install and use it in the
> [EXT:seo manual](https://docs.typo3.org/c/typo3/cms-seo/main/en-us/Index.html).

**Table of Contents**

-   [Installation](https://docs.typo3.org/permalink/t3coreapi:installation@main)
-   [How to access your XML sitemap](https://docs.typo3.org/permalink/t3coreapi:how-to-access-your-xml-sitemap@main)
-   [How to setup routing for the XML sitemap](https://docs.typo3.org/permalink/t3coreapi:how-to-setup-routing-for-the-xml-sitemap@main)
-   [XmlSitemapDataProviders](https://docs.typo3.org/permalink/t3coreapi:xmlsitemapdataproviders@main)
-   [Change frequency and priority](https://docs.typo3.org/permalink/t3coreapi:change-frequency-and-priority@main)
-   [Sitemap of records without sorting field](https://docs.typo3.org/permalink/t3coreapi:sitemap-of-records-without-sorting-field@main)
-   [Create your own XmlSitemapDataProvider](https://docs.typo3.org/permalink/t3coreapi:create-your-own-xmlsitemapdataprovider@main)
-   [Use a customized sitemap XSL file](https://docs.typo3.org/permalink/t3coreapi:use-a-customized-sitemap-xsl-file@main)

## Installation

XML sitemaps are part of the "seo" system extension. If the extension is not
available in your installation, require it as described here: [Installation, EXT:seo](https://docs.typo3.org/c/typo3/cms-seo/main/en-us/Installation/Index.html#installation)
Then include the static TypoScript template `XML Sitemap (seo)`.

## How to access your XML sitemap

You can access the sitemaps by visiting `https://example.org/?type=1533906435`.
You will first see the sitemap index. By default, there is one sitemap in the
index. This is the sitemap for pages.

> [!NOTE]
> Each siteroot and language configured in the
> [site handling](https://docs.typo3.org/permalink/t3coreapi:sitehandling@main) has its own XML sitemap depending on the
> entry point.
>
> **Example:**
>
> -   Entry point `/` \- `https://example.org/?type=1533906435`: for default language
> -   Entry point `/fr/` \- `https://example.org/fr/?type=1533906435`: for French
> -   Entry point `/it/` \- `https://example.org/it/?type=1533906435`: for Italian

## How to setup routing for the XML sitemap

You can use the [PageType decorator](https://docs.typo3.org/permalink/t3coreapi:routing-pagetype-decorator@main) to map
the page type to a fixed suffix. This allows you to expose the sitemap with a
readable URL, for example `https://example.org/sitemap.xml`.

Additionally, you can map the parameter `sitemap`, so that the links to the different
sitemap types (`pages` and additional ones, for example, from the news extension) are also mapped.

**config/sites/\<your_site>/config.yaml**

```yaml
routeEnhancers:
  PageTypeSuffix:
    type: PageType
    map:
      /: 0
      sitemap.xml: 1533906435
  Sitemap:
    type: Simple
    routePath: 'sitemap-type/{sitemap}'
    aspects:
      sitemap:
        type: StaticValueMapper
        map:
          pages: pages
          news: news
          my_other_sitemap: my_other_sitemap
```

## `XmlSitemapDataProviders`

The rendering of sitemaps is based on `XmlSitemapDataProviders`. EXT:seo ships
with two `XmlSitemapDataProviders`.

### For pages

The `\TYPO3\CMS\Seo\XmlSitemap\PagesXmlSitemapDataProvider` will generate a
sitemap of pages based on the detected siteroot. You can configure whether you
have additional conditions for selecting the pages. It is also possible to
exclude certain [doktypes](https://docs.typo3.org/permalink/t3coreapi:list-of-page-types@main). Additionally, you may
exclude page subtrees from the sitemap (e.g internal pages). This can be
configured using TypoScript (example below) or using the [constants editor](https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/UsingSetting/Entering.html#typoscript-syntax-constant-editor) in the
backend.

**EXT:my_extension/Configuration/Sets/MyExtension/setup.typoscript**

```typoscript
plugin.tx_seo {
    config {
        xmlSitemap {
            sitemaps {
                pages {
                    config {
                        excludedDoktypes = 3, 4, 6, 7, 199, 254, 255, 137, 138
                        additionalWhere = AND ({#no_index} = 0 OR {#no_follow} = 0)
                        #rootPage = <optionally specify a different root page. (default: rootPageId from site configuration)>
                        excludePagesRecursive = <comma-separated list of page IDs>
                    }
                }
            }
        }
    }
}
```

> [!NOTE]
> The doktypes 137 and 138 in the example above are custom doktypes.
> The other doktypes given are the ones excluded by default by the SEO extension.

### For records

If you have an extension installed and want a sitemap of those records, the
`\TYPO3\CMS\Seo\XmlSitemap\RecordsXmlSitemapDataProvider` can be used. The
following example shows how to add a sitemap for news records:

**EXT:my_extension/Configuration/Sets/MyExtension/setup.typoscript**

```typoscript
plugin.tx_seo {
    config {
        <sitemapType> {
            sitemaps {
                <unique key> {
                    provider = TYPO3\CMS\Seo\XmlSitemap\RecordsXmlSitemapDataProvider
                    config {
                        table = news_table
                        sortField = sorting
                        lastModifiedField = tstamp
                        changeFreqField = news_changefreq
                        priorityField = news_priority
                        additionalWhere = AND ({#no_index} = 0 OR {#no_follow} = 0)
                        pid = <page id('s) containing news records>
                        recursive = <number of subpage levels taken into account beyond the pid page. (default: 0)>
                        url {
                            pageId = <your detail page id>
                            fieldToParameterMap {
                                uid = tx_extension_pi1[news]
                            }
                            additionalGetParameters {
                                tx_extension_pi1.controller = News
                                tx_extension_pi1.action = detail
                            }
                        }
                    }
                }
            }
        }
    }
}
```

You can add multiple sitemaps and they will be added to the sitemap index
automatically. Use different types to have multiple, independent sitemaps:

**EXT:my_extension/Configuration/Sets/MyExtension/setup.typoscript**

```typoscript
seo_googlenews < seo_sitemap
seo_googlenews.typeNum = 1571859552
seo_googlenews.10.sitemapType = googleNewsSitemap

plugin.tx_seo {
    config {
        xmlSitemap {
            sitemaps {
                news {
                    provider = GeorgRinger\News\Seo\NewsXmlSitemapDataProvider
                    config {
                        # ...
                    }
                }
            }
        }
        googleNewsSitemap {
            sitemaps {
                news {
                    provider = GeorgRinger\News\Seo\NewsXmlSitemapDataProvider
                    config {
                        googleNews = 1
                        # ...
                        template = GoogleNewsXmlSitemap.xml
                    }
                }
            }
        }
    }
}
```

## Change frequency and priority

Change frequencies define how often each page is approximately updated and hence
how often it should be revisited (for example: News in an archive are "never"
updated, while your home page might get "weekly" updates).

Priority allows you to define how important the page is compared to other pages
on your site. The priority is stated in a value from 0 to 1. Your most important
pages can get an higher priority as other pages. This value does not affect how
important your pages are compared to pages of other websites. All pages and
records get a priority of 0.5 by default.

The settings can be defined in the TypoScript configuration of an XML sitemap by
mapping the properties to fields of the record by using the options
`changeFreqField` and `priorityField`.
`changeFreqField` needs to point to a field containing string values
(see `pages` TCA definition of field
`sitemap_changefreq`), `priorityField` needs to point to
a field with a decimal value between 0 and 1.

> [!NOTE]
> Both the priority and the change frequency have no impact on your rankings.
> These options only give hints to search engines in which order and how often
> you would like a crawler to visit your pages.

## Sitemap of records without sorting field

Sitemaps are paginated by default. To ensure that as few pages of the sitemap
as possible are changed after the number of records is changed, the items in the
sitemaps are ordered. By default, this is done using a sorting field. If you do
not have such a field, make sure to configure this in your sitemap configuration
and use a different field. An example you can use for sorting based on the uid
field:

**EXT:my_extension/Configuration/Sets/MyExtension/setup.typoscript**

```typoscript
plugin.tx_seo {
    config {
        <sitemapType> {
            sitemaps {
                <unique key> {
                    config {
                        sortField = uid
                    }
                }
            }
        }
    }
}
```

## Create your own `XmlSitemapDataProvider`

If you need more logic in your sitemap, you can also write your own
`XmlSitemapProvider`. You can do this by extending the
`\TYPO3\CMS\Seo\XmlSitemap\AbstractXmlSitemapDataProvider` class. The main
methods are `getLastModified()` and `getItems()`.

The `getLastModified()` method is used in the sitemap index and has to
return the date of the last modified item in the sitemap.

The `getItems()` method has to return an array with the items for the
sitemap:

**EXT:my_extension/Classes/XmlSitemap/MyXmlSitemapProvider**

```php
$this->items[] = [
    'loc' => 'https://example.org/page1.html',
    'lastMod' => '1536003609'
];
```

The `loc` element is the URL of the page to be crawled by a search engine.
The `lastMod` element contains the date of the last update of the
specific item. This value is a UNIX timestamp. In addition, you can include
`changefreq` and `priority` as keys in the array to give
[search engines a hint](https://docs.typo3.org/permalink/t3coreapi:xmlsitemap-changefreq-priority@main).

## Use a customized sitemap XSL file

The XSL file used to create a layout for an XML sitemap can be configured at
three levels:

1.  For all sitemaps:

    **EXT:my_extension/Configuration/Sets/MyExtension/setup.typoscript**

    ```typoscript
    plugin.tx_seo.config.xslFile = EXT:my_extension/Resources/Public/CSS/mySite.xsl
    ```
1.  For all sitemaps of a certain sitemapType:

    **EXT:my_extension/Configuration/Sets/MyExtension/setup.typoscript**

    ```typoscript
    plugin.tx_seo.config.<sitemapType>.sitemaps.xslFile = EXT:my_extension/Resources/Public/CSS/mySitemapType.xsl
    ```
1.  For a specific sitemap:

    **EXT:my_extension/Configuration/Sets/MyExtension/setup.typoscript**

    ```typoscript
    plugin.tx_seo.config.<sitemapType>.sitemaps.<sitemap>.config.xslFile = EXT:my_extension/Resources/Public/CSS/mySpecificSitemap.xsl
    ```

The value is inherited until it is overwritten.

If no value is specified at all, `EXT:seo/Resources/Public/CSS/Sitemap.xsl`
is used as default.
