Search engines rely on XML sitemaps to quickly locate and efficiently index a website’s pages. For a detailed breakdown of sitemap types, check out our previous post:
What is a Sitemap: Everything You Need to Know (And More)
While this article stands on its own, I recommend brushing up on the basics of XML sitemaps before diving in.
The takeaway? Any website benefits from having a sitemap. If you don’t already have one, this guide is tailored for you. Let’s kick things off with a step that doesn’t involve creating anything just yet: learning where sitemaps are typically located and how to find them easily.
How to find a sitemap?
In most cases, website owners store their XML sitemaps in straightforward locations like /sitemap.xml or /sitemap_index.xml. If the sitemap is stored elsewhere or has a unique name, you’ll often find its location listed in the robots.txt file.
The robots.txt file is a simple text document that guides web crawlers on which parts of the site they’re allowed to visit and which are off-limits. Website owners can block access to all or specific sections for all bots or just specific ones. You’ll always find this file at /robots.txt—see ours at octopus.do/robots.txt
Some websites, like Amazon or Wikipedia, have sitemaps that aren’t easily discoverable. But that doesn’t mean they don’t exist. Large platforms with dynamic content often take extra steps to control access. For instance, they might restrict sitemap visibility to search engine-specific IPs, store the file deeper within their directory structure, or give it a less obvious name - all to limit unwanted access.
There are several reasons why a sitemap might not be easy to find - ranging from security concerns to traffic management, and even SEO strategies. Some of these factors stem from the website's size, while others are influenced by its popularity or the owner's specific approach to SEO.
Curious what an XML sitemap looks like? You can check ours at octopus.do/sitemap.xml
If you've already located a sitemap.xml file on a website, you’ve likely noticed it contains links along with certain attributes assigned to them. Now, let’s dive into what these attributes mean and why they’re essential.
XML sitemap example from Octopus.do
Mandatory attributes of the sitemap
For an XML sitemap to be recognized by search engines, it must adhere to the sitemaps.org protocol, which defines the allowable information types and their formats. Missing any of the following essential tags means the sitemap won’t work:
XML declaration
A core component of the sitemap, the XML declaration ensures the content is correctly interpreted and processed. It includes details that help the processor parse the XML document. According to the XML sitemaps protocol, the version must be 1.0, and the encoding should be UTF-8. The first line of your document must look like this:
<?xml version="1.0" encoding="UTF-8"?>
attribute
This tag wraps the entire sitemap and informs search engine bots about the protocol version being used. The current version, supported by all major search engines, is 0.9. All subsequent tags should be placed under this one. The second line of the document must appear like this:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
attribute
The parent tag for each individual URL entry, where all relevant attributes for a single link are stored.
attribute
This specifies the page's address, which must be an absolute, canonical URL. It should start with the protocol (e.g., https://) and, if necessary, end with a trailing slash. The value of this tag must be under 2048 characters. It should look like this:
<url>
<loc>https://yourdomain.com/category/subcategory</loc>
</url>
While including only the mandatory tags will work fine, website owners can also use additional attributes to help influence the search engine crawling process.
Optional attributes of the sitemap
The tags in this section are entirely optional. You can choose not to include them, and search engines might still ignore them and crawl your pages based on their own criteria.
attribute
Indicates the date when the page was last modified. The format must follow YYYY-MM-DD. For example, if a page was updated on February 28, 2024, the attribute would look like this:
<url>
<loc>https://yourdomain.com/category/subcategory</loc>
<lastmod>2024-02-28</lastmod>
</url>
attribute
This tag informs search engines about how often the page is likely to change, which could help them plan their future crawling schedule. Available values include: always, hourly, daily, weekly, monthly, yearly, and never.
attribute
Defines the page's priority relative to other URLs on the same website, with values ranging from 0.0 to 1.0 (where 1.0 represents the highest priority). However, note that this doesn’t affect the page's priority compared to URLs on other sites.
<url>
<loc>https://yourdomain.com/category/subcategory</loc>
<lastmod>2024-02-28</lastmod>
<changefreq>always</changefreq>
<priority>0.5</priority>
</url>
Multilingual websites XML sitemap
Chances are, you’ve visited a multilingual website at some point. Search engines rely on specific indicators to determine which page corresponds to which language, ensuring the right results are displayed to users based on their preferences. One effective way to communicate this is through the XML sitemap. This method also helps avoid the risk of search engines marking pages as duplicates.
For instance, let’s say your website supports both English and Latvian, available at yourdomain.com/en and yourdomain.com/lv. To properly specify the language versions, your sitemap would need to include additional tags.
<url>
<loc>https://yourdomain.com/en</loc>
<xhtml:link
rel="alternate"
hreflang="en"
href="https://yourdomain.com/en" />
<xhtml:link
rel="alternate"
hreflang="lv"
href="https://yourdomain.com/lv" />
</url>
<url>
<loc>https://yourdomain.com/lv</loc>
<xhtml:link
rel="alternate"
hreflang="en"
href="https://yourdomain.com/en" />
<xhtml:link
rel="alternate"
hreflang="lv"
href="https://yourdomain.com/lv" />
</url>
XML sitemap styling
You might argue that sitemaps are designed for search engines, not humans—and you’d be absolutely right. But chances are, you’ve already glanced at a sitemap.xml file. For those who need to manually inspect a sitemap, tools like the Yoast plugin for WordPress can generate XML sitemaps enhanced with CSS and JavaScript. This styling makes the file more visually accessible for regular users.
How to create a sitemap?
In most cases, generating an XML sitemap is an automated process - it’s faster, easier, and significantly reduces the chance of errors. While manual creation is possible, the majority of website owners prefer using built-in features or third-party tools to handle the task for them.
There are numerous applications, both free and paid, that allow anyone to create a sitemap with just a few clicks. Many content management systems (CMS) come with built-in features or dedicated plugins for managing XML sitemaps. If your site runs on a CMS, I strongly recommend using these tools to generate and update your sitemap. Once set up, they handle everything automatically, ensuring your sitemap stays up-to-date as your site evolves.
If your site doesn’t have CMS support or similar technology, standalone tools like Octopus.do sitemap generator can create XML sitemaps ready for search engine submission. These tools function like web crawlers, scanning your site, identifying available links, and assembling the structure into a sitemap.xml file.
No matter which method you use, always ensure your sitemap is updated whenever a URL changes, a new page is added, or an old page is removed.
Where to place the XML sitemap file?
For most websites, the location of the sitemap.xml file doesn’t matter, as long as it’s accessible to search engines. However, unless there’s a specific reason to restrict access (like with Amazon), it’s best practice to place the sitemap in the root folder alongside the robots.txt file. This makes it easier to locate and reduces the chances of issues during website updates.
How to submit XML sitemap to Google
Before submitting a sitemap, search engines require you to verify ownership of the website. This ensures that only authorized users can manage the sitemap. For step-by-step instructions, check out Google’s site verification guide.
Once your website is added and verified, it's time to submit your sitemap to Google. Here's how:
Go to Google Search Console
Move to Sitemaps section in the left panel
Enter the path for the XML sitemap
Hit Submit button. Done!
Conclusion
Creating a sitemap is one of the simplest yet most impactful tasks in SEO. Given the minimal effort involved, the value it delivers is hard to overstate.
If you own or manage a website, start by confirming that your XML sitemap exists and is up-to-date. Next, check whether your tech solution includes automated sitemap updates—and ensure that feature is enabled.
Finally, verify that the sitemap is submitted to search engines and that there are no errors in processing. After all, the whole point is to make your content visible to search engines, right?