Understanding the structure of Sitemap.xml

Understanding the structure of Sitemap.xml

Key Attributes and Their Impact

Understanding the structure of sitemap.xml is crucial for search engine optimization (SEO) and efficient website crawling in web development. A sitemap is an XML file that lists the URLs of a website along with additional metadata about each URL. The purpose of this guide is to clarify the structure of sitemap.xml, highlighting its key attributes and the implications of different values.

1. Structure of sitemap.xml

At its core, sitemap.xml is a simple XML file that contains a list of URLs and some optional metadata. The basic structure looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <!-- More URL entries here -->

2.urlset vs. sitemapindex

There are two main types of sitemaps: urlset and sitemapindex. The urlset is a collection of URLs within a website, which is what we typically think of as a sitemap. However, for websites with large numbers of pages or frequently updated content, using a sitemapindex can be more efficient.


The urlset is a list of URLs in a single sitemap file. It's suitable for smaller websites or sections of a website. Each url tag within the urlset can contain the attributes we discussed earlier.


The sitemapindex is used to manage multiple sitemap files. This approach is beneficial for large websites because it allows splitting the sitemap into smaller, more manageable files. Each sitemap tag within the sitemapindex points to a separate sitemap file.

3. Structure ofsitemapindex

A sitemapindex file lists multiple sitemap files instead of individual URLs.

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <!-- More sitemap entries here -->

In the following example, there are two separate sitemap files: sitemap1.xml and sitemap2.xml. Each of them follow the urlset format, as shown earlier. This structure enables webmasters to segment their sitemap based on various criteria such as content type, update frequency, or any other logical division. This makes it easier to manage large-scale websites more efficiently.

4. Key Attributes

Each URL in the sitemap can have the following attributes:

  • <loc>: The URL of the page must be specified using an absolute URL.

  • <lastmod>: (Optional) This field displays the date when the file was last modified. It helps search engines recognize the most recent update.

  • <changefreq>: (Optional) This field indicates how frequently the page is expected to change. Possible values include 'always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', and 'never'. However, search engines may not strictly follow this frequency.

  • <priority>: (Optional) The priority attribute of a URL indicates its relative importance on the website, with a scale ranging from 0.0 to 1.0. It is important to note that this priority only serves as a guide for web crawlers and does not have a direct impact on the website's search engine ranking.

5. Variations and Extensions

There are extensions to the standard sitemap protocol to support specific types of content:

5.1 Image Sitemaps

For websites that contain many images, providing image information can improve their indexing by search engines.

        <image:caption>Image caption here</image:caption>
        <image:title>Image title here</image:title>

5.2 Video Sitemaps

Websites that have a lot of video content can benefit from having video sitemaps.

        <video:title>Video title here</video:title>
        <video:description>Video description here</video:description>

5.3 News Sitemaps

News websites utilize this format to optimize search engine indexing of articles.

            <news:name>Example News</news:name>
        <news:title>Article Title Here</news:title>

6. Impact and Best Practices

  • Improved Indexing: By providing a sitemap, you enable search engines to discover and index your pages more effectively.

  • Content Prioritization: Using <priority> and <changefreq> tags will help search engines prioritize crawling pages.

  • Up-to-date Information: By using the <lastmod> tag, you can inform search engines of the most recent version of your content.


The sitemap.xml file is crucial for SEO as it helps search engines to understand and index a website in a better way. Although the structure is simple, using its attributes correctly can have a significant impact on how your website's content is crawled and prioritized. As web technologies are constantly evolving, web developers and SEO specialists need to stay up-to-date with the best practices in sitemap creation.

Did you find this article valuable?

Support Maximilian Keppeler by becoming a sponsor. Any amount is appreciated!