Introduction
A sitemap lists the pages of a site so that search engines can find them. The usual file is sitemap.xml at the top
of the site, and the format is the Sitemaps XML protocol of sitemaps.org.
A large site cannot list everything in one file, so a second kind of file, the sitemap index, lists the sitemaps
instead of pages. A sitemap can be gzip-compressed, as sitemap.xml.gz.
Structure
The file is XML in UTF-8. The root is a urlset in the namespace
http://www.sitemaps.org/schemas/sitemap/0.9, with a url for each page. Only loc, the
address, is required; lastmod, changefreq and priority are optional. The
elements page has each one.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2024-02-29</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://example.com/about</loc>
</url>
</urlset>
The index has the root sitemapindex, and a sitemap with a loc and an optional
lastmod for each file it lists. A sitemap may carry extensions
for images, video, news and the language versions of a page, each in its own namespace. The
limits are 50,000 addresses and 50 MB for one file, before compression.
In the explorer
Drop sitemap.xml, sitemap_index.xml or a similarly named file on the explorer. If its root is
urlset or sitemapindex in the sitemaps.org namespace it opens as a sitemap: the XML tree, a
table of every URL with its dates, frequency, priority and extensions, a summary (the number of addresses, the hosts, the
extensions in use and the range of last-modified dates) and a list of every rule that is broken, each with its line and
column. An index shows the sitemaps it lists, by address; the explorer does not fetch them. A
sitemap.xml.gz opens through the gzip viewer, and the file inside it as a sitemap.
The options bar has a Sitemap address box. Give the address the sitemap is served at and every URL is checked against the protocol’s rule that it must use the sitemap’s protocol, host and port and lie in its directory. Any other file with such a name (an RSS feed, a page of text, an XML file in another namespace) opens as XML as it always did. The XML highlighting is used for the text.
Not described
Known, not yet covered
- Viewer: the text sitemap (one address per line) and RSS and Atom feeds used as sitemaps are not read as sitemaps; they open as text and XML.
- Viewer: the schema files
sitemap.xsdandsiteindex.xsdwere not read, so the order of the elements inside aurlis not checked, and the extension elements are checked against Google’s documentation, not their schemas. - Viewer: the Google mobile extension is recognised by its namespace only; no page about it was read.
- Viewer: the older Google namespace
http://www.google.com/schemas/sitemap/0.84is not accepted as a sitemap, since no page read for these notes names it. - Viewer: whether an address returns a page, and whether alternate-language links point back at each other, cannot be checked from one file.
Unknown
- Reference: whether a sitemap index may list another index is not stated on the sitemaps.org page we read; the viewer only notes an address that looks like an index.
Links
Reference
- sitemaps.org protocol – the format, its tags, the limits and the escaping rules
- Google: build and submit a sitemap – the formats Google reads, its limits, and the tags it ignores
- Google: image sitemaps – the image extension
- Google: video sitemaps – the video extension
- Google: news sitemaps – the news extension
- Google: localized versions of a page – alternate-language links in a sitemap