A `sitemap.xml` file is an XML file that lists the pages of a website to inform search engines about the organization of the site's content. This helps search engines crawl the site more effectively. Here’s a simple breakdown of its structure:
- XML Declaration: Indicates that the file is an XML document.
- urlset Element: The root element that contains all the URLs.
- url Element: Contains information about each URL on the site.
- loc: Specifies the URL of the page.
- lastmod: (Optional) Indicates the last modification date of the page.
- changefreq: (Optional) Suggests how frequently the page is likely to change.
- priority: (Optional) Indicates the importance of the page relative to other pages on the site.
Here is an example of a basic `sitemap.xml`:
<?xml-stylesheet type="text/xsl" href="sitemap.xsl"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap-image/1.1">
<url>
<loc>http://www.example.com/</loc>
<lastmod>2023-10-01</lastmod>
<changefreq>monthly</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>
</