A `sitemap.xml` file is an XML file that helps search engines understand the structure of your website. It provides a way to list the pages of your site and is beneficial for SEO. Here’s a simple overview of how it works:
- Purpose: To inform search engines about pages on your site for better indexing.
- Format: Uses XML syntax to list URLs.
- Components:
- urlset: The root element that wraps all url entries.
- url: Each entry that represents a single page on your website.
- loc: Specifies the URL of the page.
- lastmod: Indicates when the page was last modified.
- changefreq: Suggests how frequently the page is likely to change.
- priority: Indicates the priority of the page relative to other pages on the site.
Here’s a basic example of a `sitemap.xml` file:
<?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>daily</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>
</urlset>
Make sure to keep your