A `sitemap.xml` file is used by websites to help search engines understand the structure of your site. It provides a list of URLs that are available for crawling. Here’s a simple explanation of its components:
- XML Declaration: The header that defines the document as XML.
- URL Set: The main container for the URLs.
- URL Entry: Each URL entry contains several elements:
- loc: The location of the URL.
- lastmod: The last modified date of the URL.
- changefreq: How frequently the content is expected to change.
- priority: The priority of the URL relative to other URLs on the site.
Here’s a simple example of a `sitemap.xml` file:
<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>yearly</changefreq>
<priority>0.8</priority>
</url>
</urlset>
This format helps search engines to better index your site, improving your visibility and SEO.