12

How To Create The Perfect XML Sitemap

Bill Sebald
Founder & Managing Partner


July 26, 2016

Are you wondering how to generate an XML sitemap for your website? This guide will walk you through all the steps you need to create and implement one.

While Google and other search engines are improving at finding pages with their crawlers, sitemaps still help by effectively giving them more data about your web pages. Many XML sitemap generators are available for purchase or even for free. Your CMS may already have one built in. These applications do what they’re supposed to – crawl your site and spit out a properly formatted, static XML sitemap.

The main issue with XML sitemap generators is that they don’t automatically know which URLs should be included or excluded. While some tools can be set to follow directives like robots.txt and canonical tags, they aren’t foolproof. Unless your site is perfectly optimized, you must manually refine the sitemap. It’s rare for large, database-driven sites to be perfectly optimized, so these tools often produce incomplete or bloated sitemaps. Common problems include duplicate pages from URL parameters, language directories that get incorrectly added, and stray folders revealing process files or junk pages. The more dynamic the site, the more likely unwanted URLs will appear in the XML sitemap.

The XML sitemap should only expose the URLs you want Google to know about. Nothing more, nothing less. The XML sitemap file helps search engines get a data dump of all your important pages and supplement what they haven’t found on their own. In return, this allows these “unfound” pages to get found, crawled, and ideally (hopefully) rank within the search results.

So, what should be in the ultimate XML sitemap?

  • Only pages that 200 (page found).  No 404’s, redirects, 500 errors, etc.
  • Only pages that are not blocked by robots.txt.
  • Only pages that are the canonical page.
  • Only pages that relate to the second-level domain (meaning, no subdomains – they should get their own XML sitemap)
  • In most cases, only pages that are of the same language (even if all your language pages are on the same .TLD, that language usually gets its own sitemap)

So, in the end, the perfect XML sitemap file should 100% mirror what – in a perfect world – Google is supposed to crawl and index. Ideally, your website/CMS has an automatic process for routinely building these perfect sitemaps without your intervention. As new products or pages come in and go out, your XML sitemap should simply rewrite itself. However, the rest of this post explains how to generate a sitemap when a prototype sitemap is needed or as a quick fix for a broken sitemap generator.

What Does An Xml Sitemap Look Like?

An XML sitemap will list your site’s URLs you want Google to prioritize crawling. Look at our site map to see how one is properly structured.

How To Make A Sitemap?

logo

Screaming Frog is an incredibly powerful site crawler that is ideal for all kinds of SEO tasks. One of its several features is the ability to export perfectly written XML sitemaps. If your export is significant, it will adequately break the sitemaps up and include a sitemapindex.xml file. While at it, you can even export an image-only XML sitemap. Screaming Frog is free for small crawls, but pony up for the paid version if you have a website larger than 500 URLs. This is one tool you’ll be happy you paid for if you do SEO work. It’s a mere £99 per year (or $130).

You’re ready to go once you install Screaming Frog on your desktop. If you are working on extremely large sites, you’ll probably need to expand its memory usage. Out of the box, Screaming Frog allocates 512mb of RAM for its use. As you can imagine, the more you crawl, the more memory you’ll need.

Download > Screaming Frog

Setting Up For The Perfect Crawl

Screaming Frog looks like a lot but is very easy to use. In the Configuration > Spider setting, you can use several checkboxes to tell Screaming Frog how to behave. We’re trying to get Screaming Frog to emulate Google, so we want to make some checks here.

Check the following boxes before you run your crawl:

  • Respect Noindex
  • Respect Robots.txt
  • Do not crawl nofollow
  • Do not crawl external links
  • Respect canonical

At this point, I recommend crawling the site.  Consider this the first wave.

How to Examine Crawl Data for Sitemap Creation

Export the complete site data from Screaming Frog. We’re going to evaluate all the pages in Excel or Google Sheets. While we know we took some steps to show us only things search engines can access on their own, we want to make sure there aren’t pages they are seeing that we didn’t know about. You know, those ?color= parameters on eCommerce sites or /search/ URLs that you might not want to be indexed. I like sorting the URL column (A-Z) to scan down and see duplicate URLs quickly.

This data is super valuable not only for creating a strong XML sitemap but also for blocking pages on your website that need some tightening up. Unless your site is 100% optimized, this is a valuable, hard look at potentially runaway URLs. I recommend doing this crawl and looking at your data at least once per quarter.

Scrubbing Out Bad URLs

In this case, a “bad” URL is simply one we don’t want Google to see. Ultimately, we’ll need to make these further exclusions available to Screaming Frog. At this point, you have two options.

  1. We can either upload your clean Excel list back into Screaming Frog,
  2. or run a new Screaming Frog crawl with the exclusions built in.

Option 1: Using your spreadsheet, delete the rows containing URLs you don’t like.  Speed up the process using Excel’s filters (i.e., contains, does not contain, etc.).  The only column of data we care about is the one with your URLs. Also, use Excel’s filters to show only the 200 (page found) URLs.  The time it takes to audit this spreadsheet depends on how many URLs you have, different types of URL conventions, and how comfortable you are with Excel.

Next, copy the entire column of “good” URLs and return to Screaming Frog. Use the Mode > List option to start a new crawl. Paste your URLs and start your crawl. Once all the appropriate URLs are back into Screaming Frog, move on to the next section.

Option 2: Now that you know the URLs you want to block, you can do it with Screaming Frog’s exclude feature.  Configure > Exclude opens a small window to enter regular expressions (regex).  Not familiar with regex?  No problem. It’s very easy, and Screaming Frog gives you great examples.  https://www.screamingfrog.co.uk/seo-spider/user-guide/configuration/#exclude.

(Alternatively, you can use the include function if there are certain types of URLs or sections you specifically want to crawl.  Take the directions above, and simply reverse them.) Once you have a perfect crawl in Screaming Frog, move on to the next section below.

Export The XML Sitemap

At this stage, you’ve either chosen Option 1 or Option 2 above. You have all the URLs you want to be indexed loaded in Screaming Frog. Now, you need to do the simplest step of all—export!

export

options

You have some extra checkboxes to consider. If you ask me, it’s a very smart set of selections.

This helps you refine what goes into the XML sitemap in case you missed something in the steps above. Select what makes sense to you, and execute the export. Screaming Frog will generate the sitemaps to your desired location, which you’re ready to upload to your website. Don’t forget to get these new sitemaps into your Google Search Console and Bing Toolbox sitemap uploader.

(If you need some clarity on what these definitions are, visit https://www.sitemaps.org/protocol.html)

You’re all set! Remember, this is just a snapshot of your ever-changing site. I still thoroughly recommend generating a dynamic XML sitemap that updates as your site changes. Creating a Google sitemap will help ensure your site is always indexed correctly. I hope this was helpful!

 

Bill Sebald headshot.

Bill Sebald

Founder & Managing Partner

Bill started in SEO in 1996, early enough to have watched the discipline form around him and to have introduced some of the approaches still in use today. He founded Greenlane in 2005 as a consulting business, which reformed in 2012 as an alternative to the standard agency model: senior people, small roster, every client getting the collective attention of the whole team. His writing focuses on SEO strategy, where AI and LLMs are taking search, and unvarnished industry opinion.

In the field since
1996
Expertise
AI Search Optimization
Technical SEO
SEO Content
Off-Page SEO
SEO Training
Industries
Collectibles
E-commerce / Retail
Education
Legal
Music & Entertainment
Certifications
Google Ads
Published
LinkedIn

Outside of work, Bill is a guitarist and songwriter. When he isn’t writing or playing music, you’ll usually find him watching 80s movies.

Latest Articles

Greenlane Index: September 2026

September made the direction of search hard to ignore. AIOs now cover more of the results page, more of People Also Ask, and even business listings.

AI | Analytics

Read More

Dylan Jones
SEO Team Lead

Greenlane Index: August 2026

If there’s a thread running through this month, it’s that the “black box” framing of AI search may be starting to crack open.

AI | Analytics

Read More

Dylan Jones
SEO Team Lead

Introducing our AI Brand Perception Analysis

We’ve developed a new analysis that explores the way Large Language Models (LLMs) discover information about your brand.

AI | Digital Marketing

Read More

Adam Wells
Senior SEO Account Manager 

Why Your Brand Needs an Off-Site / PR Strategy, Thanks to AI

The number of people who land on your carefully optimized page is shrinking. People are forming an opinion about you based on third-party sources.

AI | Branding

Read More

Jenn Villa
SEO Account Manager – Content Strategist SME

Greenlane Index: July 2026

May was Google’s month with I/O announcements and a Core Update. June was the month the industry started seeing the impact.

AI | Analytics

Read More

Dylan Jones
SEO Team Lead

A Midpoint Check-In on Our 2026 Paid Media Trends Predictions

Back in December, our Paid Media predicted what 2026 would bring to the world of online advertising. Now we’re at the halfway mark.

AI | Paid Social Advertising

Read More

Jenn Villa
SEO Account Manager – Content Strategist SME

Latest Case Studies

Marketplace Strategy Assists with 82% ROAS Increase

By partnering with Greenlane Search Marketing and implementing a data-driven marketplace strategy, a leading incontinence product manufacturer achieved an 82% increase in ROAS and a 51% increase in ad-attributed sales on the Sam’s Club marketplace.

Content Optimization Efforts Lead To 155 YOY Engagement Rate Increase

Product category page optimization nets incremental SEO sessions, users and engagement rate.

Shopping Feed Optimizations Lead to 40% Increase in New Users and 161% Increase in Conversions from Free Clicks

Well-optimized product titles and descriptions boost Surfaces Across Google product listing performance, turning free clicks into additional leads and revenue for an online Amish furniture store.

Paid Social Audience Restructure Doubled MQLs and Reduced CPL by 30%

This client originally partnered with Greenlane for SEO support but quickly found they were also in need of paid advertising improvements as they struggled to land marketing qualified leads (MQLs) and opportunities from their paid social campaigns.

Tech SEO Strategy Tackles Index Bloat

A billion-dollar global information and publishing company noticed a heavy decline in their natural search traffic for a specific piece of their business.

SEO & Content Strategy lead to 77% MoM Pageview Increase

Dog Health Guide boosted incremental session, pageview, and ranking growth for leader in online pet health information.

Revenue Growth YOY Improved via Local SEO Strategy

A localized florist based in southern Australia wanted to substantially increase sales from organic traffic in order to become less reliant on pay-per-click (PPC), while building its brand and establishing itself as an authority in their local market.

Regained Position 1 for Branded Search

A high-profile homepage mysteriously went from position 1 to rendering as a video thumbnail in organic listings. We helped discover why, and fixed the rankings.

Technical SEO Grew Total Indexed Pages (From 60 to 6,086)

A prominent pet site with thousands of pages of content was only indexed for 60 of those pages.

Boost in Traffic after Manual Penalty Lifted

A professional services firm was suffering from a manual penalty, leading to a huge drop of natural search-driven leads.

Ready to partner with us?

Greenlane Marketing is a highly experienced PPC and SEO agency trusted by leading Lead Generation, E-commerce, and Media brands. We align SEO, paid media, and analytics to turn search demand into revenue growth. From day one, you’re paired with a dedicated strategist focused on your goals. Choose one-time projects or monthly retainers — whatever fits your needs. Whether it’s E-commerce, B2B, or B2C, you’ll have direct access to our strategy experts every step of the way.

Greenlane Marketing is a highly experienced PPC and SEO agency trusted by leading Lead Generation, E-commerce, and Media brands. We align SEO, paid media, and analytics to turn search demand into revenue growth. From day one, you’re paired with a dedicated strategist focused on your goals. Choose one-time projects or monthly retainers — whatever fits your needs. Whether it’s E-commerce, B2B, or B2C, you’ll have direct access to our strategy experts every step of the way.