How to Read a Sitemap File, Line by Line
A sitemap file looks like code, but it's mostly a tidy list. Each page gets one small block, and each block has an address in it. Read one block and you've read them all. The pattern repeats, so there's very little to learn.
A small example
Here's a sitemap with two pages, laid out the way the protocol describes. The addresses are made up.1
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.example.com/</loc>
<lastmod>2026-11-20</lastmod>
</url>
<url>
<loc>https://www.example.com/contact</loc>
</url>
</urlset>
The wrapper: urlset
The file begins with an opening urlset tag and ends with a closing one. The opening tag also names the protocol standard, which is the long web address you see in the example.1
You don't need to understand that address. Copy it as it is. It names the protocol the file follows, so don't change a single character of it.
One block per page: url
Each page gets its own url entry. The tags inside it are its children.1
The address: loc
The loc tag holds the page address. It's the only tag you must include inside each block. The protocol says all other tags are optional.1
Write the full address, starting with https://. Google asks for fully qualified, absolute URLs. That means "https://www.example.com/contact", not just "/contact".2
Mixing hosts in one file isn't allowed. The protocol wants all the pages in a file to share one host.1
The date: lastmod
This is the date the page was last changed. The format can be as short as year, month, day. The date must be set to when the linked page was last modified, not when the sitemap is generated.1
Easy to miss. Check what your tool does, because a date that's set to the day the file was built says nothing about the page itself.
Google uses the lastmod value if it's consistently and verifiably accurate.2
The two you can skip: changefreq and priority
You may see changefreq (how often a page changes) and priority (how much a page matters compared with your other pages). The protocol calls the value of changefreq a hint and not a command.1
Google ignores priority and changefreq values.2
Other search engines may treat them differently, so check each engine's own documents if it matters to you. The protocol itself says support for optional tags may vary among search engines.1
A few small rules
- Save the file as UTF-8.1
- Don't put anything other than URLs in a plain text sitemap.2
- Order doesn't matter. You don't have to worry about the order of the URLs.2
If a platform makes your file automatically, you'll rarely edit it. Reading it still helps you spot odd things, like pages you didn't mean to list. The sitemap overview page gives the bigger picture.
Cited material
- sitemaps.org Protocol, sitemaps.org
- Build and Submit a Sitemap, Google Search Central