A `sitemap.xml` file is an XML file that provides information about the pages on your website. It helps search engines like Google to better crawl and index your site. Here’s a simple overview of its structure and purpose:
- Purpose: To inform search engines about pages on your site that are available for crawling.
- Format: It is written in XML, a markup language that is both human-readable and machine-readable.
- Key Elements:
- urlset: The root element that wraps all URLs.
- url: Represents each individual page on your website.
- loc: The URL of the page.
- lastmod: The date when the page was last modified.
- changefreq: How often the page is likely to change (e.g., daily, weekly).
- priority: The priority of the page relative to other pages on the site.
Here’s a simple example of what a `sitemap.xml` might look like:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="sitemap.xsl" ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap-image/1.1">
<url>
<loc>https://www.example.com/</loc>
<lastmod>2023-10-01</lastmod>
<changefreq>monthly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://www.example.com/about</loc>
<lastmod>2023-09-15</lastmod>
<changefreq>yearly</changefreq>
<priority>