A `sitemap.xml` file is an XML document that provides search engines with information about the pages on a website. It helps improve the site's visibility and indexing. Here are some key points about `sitemap.xml`:
- Purpose: To inform search engines about the structure of a website.
- Format: Written in XML, it includes various tags.
- Common tags:
- urlset: The root element that contains all URLs.
- url: Represents a single URL entry.
- loc: Specifies the location of the URL.
- lastmod: Indicates the last modification date of the URL.
- changefreq: Suggests how frequently the page is likely to change.
- priority: Indicates the priority of the URL relative to other URLs on the site.
- Benefits:
- Improves search engine crawling and indexing.
- Helps new pages get discovered quickly.
- Can specify video, image, and mobile content sitemaps.
To create a simple `sitemap.xml`, you can structure it as follows:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap-image/1.1">
<url>
<loc>https://www.example.com/page1</loc>
<lastmod>2023-10-01</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://www.example.com/page2</loc>
<lastmod>2023-09