A `sitemap.xml` file is used by websites to inform search engines about pages on the site that are available for crawling. It is written in XML format and typically includes the following elements:
- <urlset>: The root element of the sitemap that contains all the URLs.
- <url>: A child element of `` that defines a single URL entry.
- <loc>: Specifies the location (URL) of the page.
- <lastmod>: Indicates the last modification date of the page.
- <changefreq>: Suggests how frequently the page is likely to change (e.g., daily, weekly).
- <priority>: Indicates the priority of the page relative to other pages on the site (values range from 0.0 to 1.0).
Here is a simple example of a `sitemap.xml` file:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap-image/1.1">
<url>
<loc>http://www.example.com/</loc>
<lastmod>2023-10-01</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>http://www.example.com/about</loc>
<lastmod>2023-09-15</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
</urlset>
Using a `sitemap.xml` helps improve a website's SEO by ensuring that search engines can discover and index all relevant pages.