A `sitemap.xml` file is an XML document that provides information about the pages, videos, and other files on a website, and the relationships between them. It helps search engines like Google to crawl the site more intelligently. Here’s a simple breakdown of its components:
- URL Set: The root element of the document is usually <urlset>, which contains all the URLs of the site.
- URL Entry: Each URL is wrapped in a <url> tag, which includes:
- <loc>: The URL of the page.
- <lastmod>: The date when the page was last modified.
- <changefreq>: How frequently the page is likely to change.
- <priority>: The priority of the page relative to other pages on the site.
Here is a basic 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>monthly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>http://www.example.com/about</loc>
<lastmod>2023-10-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
</urlset>
Including a `sitemap.xml` file in your website can significantly enhance its visibility and indexing efficiency by search engines.