A sitemap.xml is an XML file that provides information about the pages, videos, and other files on a site, and the relationships between them. Here’s a simple breakdown of its structure and purpose:
- Purpose:
- Helps search engines understand the organization of your site.
- Informs search engines about the URLs available for crawling.
- Can include metadata about each URL, like last modified date and priority.
- Structure:
- <?xml version="1.0" encoding="UTF-8"?> - Declares the XML version and encoding.
- <urlset> - The root element that contains all the URLs.
- <url> - Individual URL entries.
- <loc> - Specifies the URL of the page.
- <lastmod> - The last modified date of the page.
- <changefreq> - How frequently the page is likely to change.
- <priority> - The priority of the page relative to other URLs on the site.
Here’s a simple 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>weekly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>http://www.example.com/about</loc>
<last