Sitemap Logo Sitemap

Creates a dynamic XML sitemap of your entire site.

This plugin is for Craft CMS 2 and has been discontinued. We recommend using the SEO plugin instead, which works with Craft versions 2 and 3.

Sitemap automatically creates a dynamic XML sitemap of your entire site and informs search engines exactly which pages on your site are available for crawling.

Craft Sitemap 05

The Sitemap plugin allows you to select which sections and category groups to include in the sitemap and to set the change frequency and priority of each. If you have the Commerce plugin installed then you can also select product types to include. You can also add individual URL’s to the sitemap and set their preferences.

Note that this plugin creates an XML sitemap specifically for search engines, and not a HTML sitemap for your front-end site. Find out more about sitemaps at sitemaps​.org.

Ping Search Engines #

You have your sitemap pinged to Google and Bing by clicking on the Save and Ping” button. This will inform them that your sitemap has changed and that they should recrawl your site.

Google Webmaster Tools #

Ideally you should submit the URL of your sitemap through Google Webmaster Tools. Besides notifying Google about your sitemap, this allows you to manage and also see various information about your sitemap. Find out more here.

By default your sitemap’s URL will be your site’s root URL followed by /sitemap.xml, so for example:

Multiple Sitemaps #

If your server is running out of memory due to a large sitemap, you can break it up into smaller batches by specifying the offset (default is 0) and limit (default is 50,000) parameters in the URL as follows:

You can then create and submit a sitemaps index file to Google that contains multiple sitemap URL’s as follows:

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="">
    {% set offset = 0 %}
    {% set limit = 1000 %}
    {% for i in 0..10 %}
            <loc>{{ url('sitemap.xml') }}?offset={{ offset }}&limit={{ limit }}</loc>
            <lastmod>{{ now.atom }}</lastmod>
        {% set offset = offset + limit %}
    {% endfor %}

Settings #

Enable Site Route
Whether to automatically route /sitemap.xml to the XML sitemap

Multi Locale Sitemap Enabled
Whether to allow multiple locales to appear in the sitemap


Enable Site Route #

If you choose to disable the site route setting then Sitemap will not automatically route /sitemap.xml to the XML sitemap. Instead, you can fetch the sitemap manually by creating a template on the front-end and adding the following tag:

{{ craft.sitemap.get }}

Hooks #

Sitemap comes with the following hooks that plugins can latch onto. Create the methods in your plugin’s primary class.


Use this hook to add URL’s to the sitemap. This hook must return an array of URL’s formatted as follows:

public function addSitemapUrls()
    $urls = array(
            'url' => UrlHelper::getSiteUrl('custom-url-01'),
            'lastmodDate' => new DateTime,
            'changeFrequency' => 'weekly',
            'priority' => 0.5,
            'url' => UrlHelper::getSiteUrl('custom-url-02'),
            'lastmodDate' => new DateTime,
            'changeFrequency' => 'weekly',
            'priority' => 0.5,

    return $urls;

Troubleshooting #

The following error can appear if another plugin by the same name Sitemap” was previously installed:

Template Error: Variable "sections" does not exist.

To fix this, ensure that you have uploaded the correct plugin files and clear the cache in the Craft control panel under Settings”.