A `sitemap.xml` file is an XML file that provides information about the pages, videos, and other files on your site, as well as the relationships between them. It helps search engines like Google to crawl your site more intelligently. Here’s a simple explanation of its structure:
Basic Structure of sitemap.xml:
- urlset: The root element that contains all the url entries.
- url: Each url entry represents a single page on your website.
- loc: The URL of the page.
- lastmod: The date 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 your site (from 0.0 to 1.0).
Example of sitemap.xml:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap-image">
<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>0.5</priority>
</url>
</urlset>
This format helps search engines understand the organization of your site and improves the chances of your pages being indexed effectively.