A sitemap.xml file is an XML file that lists the URLs for a website, allowing webmasters to inform search engines about pages on their site that are available for crawling. It provides metadata about each URL, such as when it was last updated, how often it usually changes, and how important it is in relation to other URLs in the site. This helps search engines to more intelligently crawl the site.
The sitemap.xml file follows a standard XML format. Here’s an example of a basic sitemap:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2023-07-10</lastmod>
<changefreq>monthly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://example.com/about</loc>
<lastmod>2023-07-10</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://example.com/contact</loc>
<lastmod>2023-07-10</lastmod>
<changefreq>yearly</changefreq>
<priority>0.5</priority>
</url>
</urlset>
<urlset>: The root element that contains the list of URLs. It should include the XML namespace: xmlns="http://www.sitemaps.org/schemas/sitemap/0.9".<url>: Encloses each URL entry. Multiple <url> elements can be nested within the <urlset> element.<loc>: The URL of the page. This is a required element.
<loc>https://example.com/</loc><lastmod>: The date the URL was last modified. This is optional but useful for search engines to know if the content has been updated.
<lastmod>2023-07-10</lastmod><changefreq>: Indicates how frequently the content at the URL is likely to change. This is optional.
always, hourly, daily, weekly, monthly, yearly, never<changefreq>monthly</changefreq><priority>: A number between 0.0 and 1.0 that indicates the priority of the URL relative to other URLs on the site. This is optional.
<priority>1.0</priority>sitemap.xml file by hand if your site is small and doesn’t change often.robots.txt file.
Sitemap: https://example.com/sitemap.xmlBy using a sitemap.xml file, you can enhance the visibility of your website's pages in search engine results, leading to better indexing and potentially higher rankings.