Configure a sitemap
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.
By default, SXA uses the Target hostname in the Basic section of the site definition item when generating sitemap URLs. If this field is empty, SXA uses Host name when it contains a single explicit hostname. SXA falls back to the host in the current request if Host name:
- Is blank.
- Contains
*. - Contains multiple hostnames.
When no request host is available, SXA falls back to the the host configured in Globals.ServerUrl. An empty Target hostname and Host name do not by themselves cause the sitemap to return a 404 error.
To make sitemap URLs use the intended public host and protocol, configure Target hostname and Scheme on the site definition item at <site collection>/<site>/Settings/Site Grouping/Site.
To configure the sitemap for your site:
- In the Content Editor, navigate to
<site>/Settings/Sitemap. - Fill in the following fields:
- Tab: Field
- Alternate links: Generate alternate links
- Include x-default: Select to add the xhtml 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:
- hreflang: Specify language and region options for the hreflang attribute language and region - URLs are rendered both for region dependent and independent codes. Example region only - URLs are rendered only for region dependent codes. Example language only - URLs are rendered only region independent codes. Example:
- Urlset attributes: lastmod
- changefreq: Select to render the
changefreqattribute that belongs to theURLelement. Specifies how often the page changes its content. - priority: Select to render the
priorityattribute that belongs to theURLelement. Specifies a number between 0 and 1 that represents the importance of a specific page. - URL options: Link provider name
- Content crawling: Crawler
- Cache: Refresh threshold
- 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.
- Cache Type: Cache Expiration - Specify in minutes the lifetime of the sitemap in the
HttpRuntime.Cacheproperty. - Sitemap index: Maximum number of pages per sitemap
- Media items: Generate sitemap media items