pay with Klarna
Payment options
Fast & Reliable
Detailed & Accurate
Useful & Valuable
Previous slide
Next slide

How to Create an XML sitemap

An XML sitemap outlines the structure of a website, providing search engines with information about its various pages, their hierarchy, and the relationship between them.
How to create an XML sitemap

As you optimise your website for search engines and users alike, the significance of XML sitemaps becomes increasingly evident. Not only do they streamline the indexing process, but they also contribute to a well-structured website that offers a seamless browsing experience.


By understanding the necessity, benefits, and best practices associated with XML sitemaps, you can improve your website’s visibility, discoverability, and overall performance.

What is an XML Sitemap?

An XML sitemap outlines the structure of a website, providing search engines with information about its pages, their hierarchy, and the relationship between them. In simple terms, it’s a file that assists search engine crawlers in comprehensively indexing your website’s content, ensuring that no valuable pages are missed.

Is it Necessary to Have an XML Sitemap?

While search engines have become more and more sophisticated at crawling and indexing websites, XML sitemaps remain beneficial for websites. Here’s why having an XML sitemap is recommended:


Enhanced Discoverability: XML sitemaps guide search engine crawlers, ensuring they can find and index your site’s relevant pages. This is especially helpful for websites with complex navigation or content.


Priority and Frequency: Within an XML sitemap, you can indicate each page’s priority and update frequency. This information helps search engines understand which pages are more important and must be crawled more frequently.


Indexing of Rich Media: If your website contains images, videos, or other multimedia elements, an XML sitemap may provide metadata about these assets, helping search engines index and display them in relevant search results.


Crawling Efficiency: For larger websites, especially, XML sitemaps can help prevent search engine crawlers from getting lost in complex structures, leading to a more efficient and accurate indexing process.

What Should an XML Sitemap Contain?

Creating a robust XML sitemap involves understanding its key components and how they contribute to SEO. Here’s what your XML sitemap should contain:


URLs: List all the URLs of your website’s pages that you want to be indexed. This includes your homepage, subpages, blog posts, product pages, etc. Essentially, any URL with a 200-status, that is indexable and with a self-referencing canonical should be included. 


Last Modification Date: Indicate when each page was last updated. This helps search engines determine the freshness of your content.


Change Frequency (optional): Specify how often the page’s content will change. You can use values like ‘always,’ ‘hourly,’ ‘daily,’ ‘weekly,’ ‘monthly,’ ‘yearly,’ and ‘never.’


Priority (optional): Assign a priority value to each page, indicating its relative importance within your website. Priority values range from 0.0 (lowest) to 1.0 (highest).


Images and Media (optional): If your site includes images, videos, or other media files, include relevant metadata such as image captions and titles.

How Do You Create an XML File?

There are a few ways you can create an. XML sitemap and your chosen method may depend on the CMS, your business needs and more. If your website is built on WordPress or something similar, there are plugins that can help create a sitemap for you – the same can also be said for extensions on platforms such as Magento. 


Assuming you do not have an automated solution, you may choose to follow this process to craft an effective XML sitemap for your website:

  1. Website Crawl: Identify all the pages on your website that you want to be included. This includes main pages, subpages, blog posts, and media files.
  2. Choose a Sitemap Generator: You can create the XML sitemap manually from your website crawl, use a crawling tool to build one or use an online tool such as xml-sitemap generator or SEOptimer.
  3. Structure and Format: Ensure your XML sitemap follows the standard format. Each URL entry should be enclosed within <url> tags and include <loc> for the URL itself. Additional tags like <lastmod>, <changefreq>, and <priority> can be added as needed.
  4. Submitting to Search Engines: Once you’ve created your XML sitemap, submit it to popular search engines like Google and Bing through their webmaster tools. This step ensures search engines can easily access the sitemap file.
  5. Regular Updates: As your website evolves, ensure that you also update your XML sitemap; how easy it is to do this depends on the method you have chosen for generating the file. Adding new pages, modifying content, and updating the last modification date helps search engines stay up-to-date with your site’s changes.

Best Practices for XML Sitemaps

Creating an XML sitemap is one thing but there are also some best practices that it is also worth keeping in mind as you generate and maintain your file. 


Size and Quantity: Keep your XML sitemap size appropriate. While there is no strict limit, keeping it under 50,000 URLs and less than 50MB is generally recommended by search engines. Consider creating multiple sitemaps or prioritising pages if your site exceeds these limits.


Priority and Frequency: Use priority and change frequency values carefully. They are optional values and resist setting every page as top priority as this may have little effect. 


Canonicalisation: Ensure that the URLs in your XML sitemap match the canonical URLs you’ve defined for your pages. This helps prevent duplication issues and confusion for search engines.


Take the time to generate a useful sitemap that can be easily accessed and read by search engines (you can find any issues in Google Search Console), and you should see a difference in your crawl rate. 

Picture of Nikki Halliwell

Nikki Halliwell

Based in Manchester, UK, Nikki is a freelance Technical SEO Consultant. She has worked at several agencies and in-house and has worked across the health, hospitality and fashion industries and more. Nikki enjoys working with eCommerce websites and beyond to ensure that websites are easy to find, load quickly and work efficiently.