FANDOM


The syntax for the Sitemaps protocol is in XML format, encoded in UTF-8, and is very strict. A Sitemap must begin with an opening <urlset> tag and end with a closing </urlset> tag.

Within the <urlset> tag, you must specify the protocol standard. You must include a <url> entry for each URL, as a parent XML tag, and include a <loc> child entry for each <url> parent tag. All other tags are optional, although support for them may vary among search engines. As such, you should always refer to each search engine's documentation for details.

All URLs must be from a single host, such as www.example.com. [1]

Sample

A sample XML sitemap is shown below. It contains just one URL and uses all optional tags.

<?xml version="1.0" encoding="UTF-8"?>
 
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <url>
      <loc>http://www.example.com/</loc>
      <lastmod>2005-01-01</lastmod>
      <changefreq>monthly</changefreq>
      <priority>0.8</priority>
   </url>
</urlset>

Tags Explained

Attribute Required? Description
urlset Yes Encapsulates the file and references the current protocol standard.
url Yes Parent tag for each URL entry. The remaining tags are children of this tag.
loc Yes URL of the page. Must begin with the protocol (i.e. HTTP) and end with a trailing slash. Value must be less than 2,048 characters.
lastmod No Date of last modification of the file. Should be in W3C Datetime format, which allows you to omit the time portion and use YYYY-MM-DD.
changefreq No

How frequently the page is likely to change. Valid values include:

priority No Priority of this URL relative to other URLs on a site. Valid values range from 0.0 to 1.0, with a default value of 0.5.

References

  1. https://www.sitemaps.org/protocol.html

Notes

  1. The "always" value should be used to describe documents that change every time they are accessed.
  2. The "never" value should be used to describe archived URLs.