Skip to main content

Configure a sitemap

Abstract

Set up the sitemap for a site.

Sitemaps help search engine crawlers navigate your site and improve search engine optimization (SEO). By default, the sitemap is generated for the whole site and stored in cache. An XML sitemap is created specifically for search engines to show details of the available pages in a website, their relative importance, and the frequency of content updates.

In the sitemap, each page is represented by a URL element.

Note

By default, the sitemap uses the Host Name defined in the Basic section in the site definition item of your site (Tenant/Site/Settings/Site Grouping/Site). If both the Host Name and the TargetHostName fields are empty, the sitemap returns a 404 error.

To ensure that the sitemap link is generated properly, we recommend that you configure the target hostname and scheme on the site definition item.

To configure the sitemap for your site:

  1. In the Content Editor, navigate to <site>/Settings/Sitemap.

  2. Fill in the following fields:

Tab

Field

Description

Alternate links

Generate alternate links

Select to add xhtml:link elements to the URL elements in the sitemap. xhtml:link is used for alternate links, for example to link to other language versions of the same page.

Example:

<url>
    <loc>https://sxa</loc>
    <lastmod>2021-10-28</lastmod>
    <changefreq>daily</changefreq>
    <priority>0.5</priority>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://sxa" />
    <xhtml:link rel="alternate" hreflang="en" href="https://sxa/en" />
    <xhtml:link rel="alternate" hreflang="da" href="https://sxa/da" />
</url>

Include x-default

Select to add the xhtml:link element with hreflang set to x-default to the URL element. The x-default value signals to the search algorithm that the page does not target any specific language or region.

Example:

<xhtml:link rel="alternate" hreflang="x-default" href="https://sxa" />

hreflang

Specify language and region options for the hreflang attribute:

  • with language and region - URLs are rendered both for region dependent and independent codes. Example:

    <xhtml:link rel="alternate" hreflang="en" href="https://sxa/en" />
    <xhtml:link rel="alternate" hreflang="en-US" href="https://sxa/en-US" />
    <xhtml:link rel="alternate" hreflang="en-CA" href="https://sxa/en-CA" />
  • with region only - URLs are rendered only for region dependent codes. Example:

    <xhtml:link rel="alternate" hreflang="en-US" href="https://sxa/en-US" />
    <xhtml:link rel="alternate" hreflang="en-CA" href="https://sxa/en-CA" />
  • with language only - URLs are rendered only region independent codes. Example:

    <xhtml:link rel="alternate" hreflang="en" href="https://sxa/en" />
    <xhtml:link rel="alternate" hreflang="da" href="https://sxa/da" />

Urlset attributes

lastmod

Select to render the lastmod attribute that belongs to the URL element. Specifies the date when the page was last modified.

changefreq

Select to render the changefreq attribute that belongs to the URL element. Specifies how often the page changes its content.

priority

Select to render the priority attribute that belongs to the URL element. Specifies a number between 0 and 1 that represents the importance of a specific page.

URL options

Link provider name

Specify a custom link provider. It is added to the providers node under the linkManager node in the Sitecore.config file. If you leave it blank, the default link provider of the site is used.

Content crawling

Crawler

Specify the name of the item crawler that fetches items from your site. The default value is itemCrawler. You can define multiple item crawlers in the sitemapItemCrawler element.

Example:

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
    <sitecore>
        <experienceAccelerator>
            <siteMetadata>
                <sitemapItemCrawler>
                    <add name="itemCrawler" type="Sitecore.XA.Foundation.SiteMetadata.Sitemap.ItemCrawler, Sitecore.XA.Foundation.SiteMetadata" />
                </sitemapItemCrawler>
            </siteMetadata>
        </experienceAccelerator>
    </sitecore>
</configuration>

Cache

Refresh threshold

Specify in minutes the minimum time slot between rebuild operations. The sitemap is rebuilt on publish. For example, if the refresh threshold is greater than 0, then the next rebuild operation does not occur earlier than the time of the most recent rebuild operation plus the time you have specified.

The purpose of this field is to prevent excessive sitemap rebuild jobs when there are many publishing operations.

Cache Type

Specify how the sitemap is stored:

  • Inactive - turns the sitemap off.

  • Stored in cache - stores the sitemap for the whole site in the cache. Select this option if your site is hosted on an environment such as Azure and you cannot easily store files on a drive, or if your site is very dynamic and you have to re-generate the sitemap almost every time it is requested. This option is turned on by default.

  • Stored in file - stores the sitemap for the whole site in a file. Select this option if you have a large site that does not change frequently.

Sitemap index

Maximum number of pages per sitemap

Specify the number of pages to be included in a sitemap. If the number of pages on the site exceeds the limit, then the URL entries are divided into multiple sitemaps, and a sitemap index is generated that links to these sitemaps.

Note

If you leave the field undefined, all URL entries are rendered into a single sitemap.

Media items

Generate sitemap media items

Select to generate media items where the sitemaps are stored when the site is published. Storing sitemaps in media items is required to deliver the sitemap files to the rendering host through the Experience Edge service. Enabled by default.

Note

This field is only applicable with headless sites.