DEV Community

Rijul Rajesh
Rijul Rajesh

Posted on

Sitemap Basics for Developers: Key Elements and How They Help with SEO

When you submit a sitemap to search engines, you are giving them a roadmap of your website. A sitemap is essentially an XML file that lists important URLs along with metadata that helps search engines decide how often to crawl and how important each page is in the overall structure of your site. While it sounds technical, the structure is actually pretty straightforward once you break it down.

In this article, we will go through the key elements: urlset, sitemapindex, changefreq, and priority.

The urlset element

Every sitemap begins with the urlset element. This is the container that holds all the URLs you want to expose to search engines. Inside urlset, each page of your site is wrapped inside a url tag.

Example:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/</loc>
    <lastmod>2025-09-18</lastmod>
    <changefreq>daily</changefreq>
    <priority>1.0</priority>
  </url>
  <url>
    <loc>https://example.com/blog/</loc>
    <lastmod>2025-09-15</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.8</priority>
  </url>
</urlset>
Enter fullscreen mode Exit fullscreen mode

Here, each url block contains:

  • loc: the URL of the page

  • lastmod: the date when the page was last modified

  • changefreq: how often the page might change

  • priority: how important the page is compared to other pages

The sitemapindex element

For larger websites, a single sitemap might not be enough. Search engines generally allow up to 50,000 URLs in one sitemap file, but many websites cross that limit. In such cases, a sitemapindex is used.

<sitemapindex> acts like a directory that points to multiple sitemap files.

Example:

<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://example.com/sitemap-pages.xml</loc>
    <lastmod>2025-09-18</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://example.com/sitemap-blog.xml</loc>
    <lastmod>2025-09-17</lastmod>
  </sitemap>
</sitemapindex>
Enter fullscreen mode Exit fullscreen mode

This way, you can organize your sitemaps by sections, such as one for product pages, one for blog posts, and so on.

The changefreq element

changefreq is an optional tag that gives search engines a hint about how often the page content is likely to change. It does not guarantee that the search engine will crawl at that exact frequency, but it helps them prioritize.

Common values include:

  • always for frequently updated content like news

  • hourly for real time updates

  • daily for blogs or active sites

  • weekly for less active sections

  • monthly for static pages like About Us

  • yearly for rarely changing pages like legal terms

  • never for archived or permanent content

The priority element

priority is another optional tag that indicates the importance of a URL relative to other URLs on your site. The value ranges from 0.0 to 1.0, with 1.0 being the highest priority.

Example values:

  • 1.0 for homepage or core landing pages

  • 0.8 for important sections like blogs or product categories

  • 0.5 for regular articles or less critical pages

  • 0.2 for low importance content like archives

Remember that priority is relative. Search engines do not compare your site’s priorities with another site, only within your own sitemap.

Putting it all together

A sitemap is not just a list of links. It is a structured way of communicating with search engines, letting them know which pages are important, how often they are updated, and how they relate to each other. Using urlset for listing URLs, sitemapindex for grouping multiple sitemaps, and metadata like changefreq and priority, you can guide crawlers to make better sense of your website.

Even though search engines are smart enough to crawl without sitemaps, providing one gives you more control and ensures that no important page is overlooked.

If you’ve ever struggled with repetitive tasks, obscure commands, or debugging headaches, this platform is here to make your life easier. It’s free, open-source, and built with developers in mind.

👉 Explore the tools: FreeDevTools

👉 Star the repo: freedevtools

Top comments (0)