A `sitemap.xml` file is an XML file that lists the pages of a website to help search engines index the site more effectively. Here are the key components of a `sitemap.xml`:
- XML Declaration: Indicates the file is an XML document.
- URL Set: The root element of the sitemap, usually defined as urlset.
- URL Entry: Each URL on your site is enclosed in url tags.
- loc: Specifies the URL of the page.
- lastmod: Indicates the last modification date of the page (optional).
- changefreq: Suggests how frequently the page is likely to change (optional).
- priority: Indicates the priority of the page relative to other pages (optional).
Here is a simple example of a `sitemap.xml`:
<?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>weekly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>http://www.example.com/about</loc>
<lastmod>2023-09-25</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
</urlset>
This structure helps search engines understand the organization and priority of your site's content.