How to Generate a Sitemap.xml for Your Site (Every Stack Covered)
Step-by-step guide to generate sitemap.xml for Next.js, Webflow, Shopify, Lovable, WordPress, and Framer. Technical walkthroughs for every stack.
Why Your Sitemap Matters (And Why You Probably Don't Have One)
You shipped. Your site is live. But Google might not know what pages actually exist on your domain.
A sitemap.xml is the map you hand to search engines. It lists every URL on your site that you want indexed. Without it, Googlebot crawls blindly—missing pages, wasting crawl budget on redirects, and leaving organic visibility on the table.
Here's the brutal truth: most founders don't have a sitemap. Or they have one that's outdated, broken, or incomplete. That's money left on the table.
This guide covers every stack. Next.js. Webflow. Shopify. Lovable. WordPress. Framer. Pick your platform, follow the steps, and get indexed properly. No agency. No fluff. Just ship.
Prerequisites: What You Need Before Starting
Before you generate a sitemap, you need three things:
1. A live domain. Your site has to be publicly accessible. If you're still in staging or localhost, skip this for now—come back when you ship.
2. Access to your hosting or platform admin. You'll need to either upload files to your server, configure settings in your platform's dashboard, or run commands in your terminal. Know your stack.
3. A list of pages you want indexed. Not every page belongs in a sitemap. Exclude login pages, thank-you pages, duplicate content, and pages you don't want ranking. Think through what matters.
4. Google Search Console access. After you generate your sitemap, you'll submit it to Google. You need a verified property in Google Search Console. Set this up now if you haven't already.
Optional but smart: also set up Bing Webmaster Tools and submit your sitemap there. Bing crawls differently than Google, and you want both search engines to know your site structure.
Once you have these four things, pick your stack below and follow the walkthrough.
Next.js: Automated Sitemap Generation with next-sitemap
Next.js doesn't generate a sitemap automatically. You need to add it.
The best approach: use the next-sitemap package. It's lightweight, actively maintained, and generates a fresh sitemap on every build. No manual updates. No broken links. Just automation.
Step 1: Install the Package
Open your terminal and run:
npm install next-sitemap
Or if you use yarn:
yarn add next-sitemap
Step 2: Create the Configuration File
In your project root (same level as package.json), create a new file called next-sitemap.config.js:
/** @type {import('next-sitemap').IConfig} */
const config = {
siteUrl: process.env.SITE_URL || 'https://yourdomain.com',
generateRobotsTxt: true,
sitemapSize: 50000,
changefreq: 'daily',
priority: 0.7,
exclude: ['/admin', '/api/*', '/thank-you', '/404'],
robotsTxtOptions: {
sitemaps: [
'https://yourdomain.com/sitemap.xml',
],
policies: [
{
userAgent: '*',
allow: '/',
disallow: ['/admin', '/api'],
},
],
},
};
module.exports = config;
Replace yourdomain.com with your actual domain. The exclude array tells the generator which pages to skip. Add any pages you don't want indexed.
Step 3: Update Your Build Script
In package.json, find your build script and add the sitemap generation command before your Next.js build:
"scripts": {
"build": "next-sitemap && next build",
"dev": "next dev"
}
Now every time you run npm run build, your sitemap regenerates automatically.
Step 4: Deploy and Verify
Deploy your changes. After deployment, visit https://yourdomain.com/sitemap.xml in your browser. You should see XML output listing all your pages.
If you see nothing or a 404, check your build logs. Make sure the sitemap generation step completed without errors.
Pro tip: Next.js also generates robots.txt automatically with next-sitemap. This tells search engines where to find your sitemap. You get both in one step.
Webflow: Native Sitemap Without Code
Webflow handles sitemaps for you. You don't need to code anything. But you need to enable it and verify it's working.
Step 1: Enable Sitemap Generation in Webflow
Log into your Webflow project. Go to Project Settings → SEO (or Hosting depending on your Webflow version).
Look for the Sitemap section. According to Webflow's official documentation, sitemaps are enabled by default on published sites. But verify it's turned on.
Webflow automatically includes:
- All published pages
- CMS collection pages
- Localized pages (if you have multiple languages)
Webflow automatically excludes:
- Password-protected pages
- Draft pages
- Redirect pages
Step 2: Exclude Pages You Don't Want Indexed
If you have pages you want to hide from search engines, Webflow gives you two options:
Option A: Hide from Search Engines
Select the page in your Webflow navigator. Open SEO Settings → check Hide from search engines. This page won't appear in your sitemap and gets a noindex tag.
Option B: Password Protect
Password-protected pages are automatically excluded from sitemaps. Use this if you want to keep a page live but hidden from search engines.
Step 3: Find Your Sitemap URL
Your Webflow sitemap lives at:
https://yourdomain.com/sitemap.xml
Visit that URL in your browser. You should see XML output with all your published pages listed.
Step 4: Submit to Google
Copy your sitemap URL. Go to Google Search Console, select your property, and navigate to Sitemaps in the left menu.
Paste your sitemap URL and click Submit. Google will crawl it immediately.
Common issue: If Google says your sitemap is invalid, check that your domain is verified in Search Console. Webflow sometimes requires you to verify ownership before sitemaps appear.
Shopify: Automatic Sitemaps for Products and Collections
Shopify generates sitemaps automatically. But most store owners don't know this, and they often miss critical configuration steps.
Here's how to make sure yours is complete and properly submitted.
Step 1: Verify Your Sitemap Exists
Your Shopify store has sitemaps at:
https://yourstore.myshopify.com/sitemap.xml
Or if you use a custom domain:
https://yourdomain.com/sitemap.xml
Visit that URL. You should see XML. If you see a 404, your store might have custom settings blocking it. Contact Shopify support.
Step 2: Check What's Included
Shopify's sitemap includes:
- All published products
- All published collections
- Your main pages (Home, About, Contact, etc.)
- Blog posts (if you have a blog)
Shopify's sitemap excludes:
- Draft products
- Hidden collections
- Password-protected pages
- Cart and checkout pages
If you have products that should be indexed but aren't showing up, check their publication status. Hidden or draft products won't appear.
Step 3: Optimize Your Product Metadata
Before submitting your sitemap, make sure your products have:
- Unique titles (not all "Product")
- Descriptions with keywords
- High-quality images
- Proper pricing and availability data
This metadata appears in search results and AI overviews. If you're shipping on Shopify, read our guide on how to audit a Shopify store in under 30 minutes to catch common issues before submitting your sitemap.
Step 4: Submit to Google and Bing
Go to Google Search Console. Select your Shopify property.
Navigate to Sitemaps → Add a sitemap.
Enter your sitemap URL (the one from Step 1) and click Submit.
Google will crawl it within minutes. You'll see the number of URLs indexed in the Sitemaps report.
Do the same in Bing Webmaster Tools. Bing crawls Shopify stores differently, and you want both search engines to see your complete product catalog.
Pro tip: If you have multiple sitemaps (one for products, one for collections, one for pages), you can create a sitemap index file. But Shopify handles this automatically—you just submit the main sitemap.xml and Shopify's system references the others internally.
Lovable: Generating a Sitemap for Your No-Code App
Lovable (formerly Lovable.dev) is a no-code builder. It doesn't auto-generate sitemaps like Webflow or Shopify. You need to create one manually.
Here's the fastest way:
Step 1: Identify All Your Public Pages
Open your Lovable project. List every page you want indexed:
- Homepage
- About page
- Pricing page
- Blog posts (if any)
- Feature pages
- Contact page
Don't include:
- Admin pages
- User dashboards
- Login pages
- Redirect pages
Step 2: Use a Free Sitemap Generator
Since Lovable doesn't have built-in sitemap generation, use a third-party tool. The easiest: XML Sitemaps Generator.
It's free, requires no signup, and works for sites up to 500 pages.
Steps:
- Go to xml-sitemaps.com
- Enter your domain
- Click Start
- Wait for it to crawl your site (usually 30 seconds to 2 minutes)
- Download the
sitemap.xmlfile
Step 3: Upload to Your Lovable Project
You have two options:
Option A: Upload to Your Server
If Lovable gives you FTP or file access, upload the sitemap.xml file to your root directory.
Then visit https://yourdomain.com/sitemap.xml to verify it's accessible.
Option B: Host on a CDN
If you don't have file access, upload your sitemap.xml to a CDN like Cloudflare, Netlify, or Vercel. Then point your domain's root to that CDN.
Or use a service like Dropbox Public Links to host the file and reference it in your robots.txt:
User-agent: *
Allow: /
Sitemap: https://yourdomain.com/sitemap.xml
Step 4: Regenerate Regularly
Unlike Next.js or Webflow, your Lovable sitemap won't update automatically. If you add new pages, you need to regenerate.
Set a reminder: Every month, run the XML Sitemaps Generator again and upload the new file. It takes 5 minutes.
Or use SpyFu's guide on creating sitemaps for more advanced automation options if you're comfortable with code.
Step 5: Submit to Search Engines
Once your sitemap is live and accessible, submit it to Google Search Console and Bing Webmaster Tools (same process as Shopify above).
WordPress: Automatic Sitemaps with Yoast or Rank Math
WordPress doesn't generate sitemaps natively (unless you're on WordPress.com). You need a plugin.
The two best options: Yoast SEO or Rank Math. Both are free, both work well, both auto-update your sitemap.
We'll cover Yoast here (Rank Math is similar).
Step 1: Install Yoast SEO
Log into your WordPress admin. Go to Plugins → Add New.
Search for "Yoast SEO." Click Install Now → Activate.
Step 2: Configure Sitemap Settings
After activation, go to Yoast SEO → Settings → Sitemaps.
You'll see options for:
- XML Sitemaps: Toggle this ON
- Post types: Check which post types to include (Posts, Pages, Products if you use WooCommerce)
- Taxonomies: Check which taxonomies to include (Categories, Tags)
- Exclude posts: Add any post IDs you don't want indexed
Leave most defaults as-is. The important setting: make sure XML Sitemaps is enabled.
Step 3: Find Your Sitemap URL
Your WordPress sitemap is at:
https://yourdomain.com/sitemap_index.xml
Or for specific post types:
https://yourdomain.com/post-sitemap.xml
https://yourdomain.com/page-sitemap.xml
Visit the index URL in your browser. You should see XML with links to sub-sitemaps.
According to Yoast's comprehensive guide on XML sitemaps, this index file is the one you submit to Google—not the individual sitemaps.
Step 4: Exclude Pages You Don't Want Indexed
In Yoast, you can exclude specific posts from your sitemap. Edit any post → scroll to the Yoast SEO box → click Advanced → toggle Remove from XML sitemap.
This is useful for thank-you pages, internal tools, or duplicate content.
Step 5: Submit to Google and Bing
Go to Google Search Console. Select your WordPress property.
Navigate to Sitemaps → Add a sitemap.
Enter your sitemap index URL (sitemap_index.xml) and click Submit.
Google will crawl it and start indexing your posts and pages.
Repeat the process in Bing Webmaster Tools.
Pro tip: Yoast also generates a robots.txt file automatically. This file tells search engines where to find your sitemap. You get both in one plugin.
Framer: Sitemap Generation for Design-First Sites
Framer is a design tool first, SEO tool second. But you can still generate proper sitemaps.
Framer doesn't auto-generate sitemaps like Webflow. You need to create one manually or use a third-party tool.
Here's the approach that works:
Step 1: Map Your Framer Pages
Open your Framer project. List every page you've published:
- Homepage
- Product/Feature pages
- Pricing
- Blog (if applicable)
- Contact
- About
Note the exact URLs. Framer typically uses clean URLs like https://yourdomain.com/about or https://yourdomain.com/pricing.
Step 2: Generate a Sitemap Using a Tool
Since Framer doesn't have built-in sitemap generation, use XML Sitemaps Generator (same as Lovable).
- Go to xml-sitemaps.com
- Enter your Framer domain
- Click Start
- Let it crawl your site
- Download the
sitemap.xmlfile
Framer will usually crawl cleanly since it's a modern platform with good HTML structure.
Step 3: Host Your Sitemap
Framer gives you limited file hosting options. Your best bet:
Option A: Use Framer's Built-In File Hosting
Some Framer projects allow you to add custom files. Check your project settings for file upload options.
Option B: Host on a CDN
Upload your sitemap.xml to Cloudflare, Netlify, or Vercel. Point your domain to that CDN.
Option C: Use a Redirect Service
Host your sitemap.xml on a free service like Dropbox, GitHub Pages, or Gist. Then reference it in your robots.txt.
Step 4: Add to robots.txt
Framer lets you customize your robots.txt file. Add this line:
Sitemap: https://yourdomain.com/sitemap.xml
This tells search engines where to find your sitemap, even if it's hosted externally.
For more on Framer SEO setup, check our guide on Framer SEO: Beautiful sites that also rank.
Step 5: Submit and Monitor
Go to Google Search Console. Submit your Framer sitemap.
Watch the Sitemaps report. If Google finds errors (like 404s or invalid XML), the report will tell you.
If you see errors, regenerate your sitemap using the tool above. Framer sites are usually clean, so errors are rare.
Submitting Your Sitemap to Search Engines
Once you've generated your sitemap, you need to tell search engines it exists.
Google Search Console
- Go to Google Search Console
- Select your verified property
- Click Sitemaps in the left menu
- Click Add a sitemap
- Paste your sitemap URL
- Click Submit
Google crawls sitemaps within minutes. You'll see the number of URLs discovered in the Sitemaps report.
Important: If Google says your sitemap is invalid, check:
- Is your domain verified in Search Console?
- Is your sitemap URL correct?
- Does the sitemap XML validate? Use the official sitemap protocol spec to check.
Bing Webmaster Tools
- Go to Bing Webmaster Tools
- Select your site
- Click Sitemaps in the left menu
- Click Submit a sitemap
- Paste your sitemap URL
- Click Submit
Bing crawls differently than Google. Submitting to Bing ensures your site gets indexed in Bing search results (and Copilot, which also uses Bing's index).
Robots.txt
You can also reference your sitemap in your robots.txt file:
User-agent: *
Allow: /
Disallow: /admin
Sitemap: https://yourdomain.com/sitemap.xml
This tells all crawlers where to find your sitemap without manual submission. Google and Bing both check robots.txt automatically.
Pro tip: According to Google's official sitemap documentation, you can have multiple sitemaps. If your site is large (over 50,000 URLs), create a sitemap index file that references multiple sitemaps. Most platforms handle this automatically.
Sitemap Best Practices (Don't Skip This)
Generating a sitemap is one thing. Generating a good sitemap is another.
Include Only Indexable Pages
Your sitemap should only list pages you want indexed. Don't include:
- Duplicate content
- Thin pages with little value
- Login or authentication pages
- Thank-you pages
- Redirect pages
- Paginated results (like
/page/2,/page/3)
If a page has noindex tag, it shouldn't be in your sitemap. Search engines will ignore it anyway.
Set Correct Priorities and Frequencies
Most sitemaps let you set:
- Priority: How important each page is (0.0 to 1.0). Homepage = 1.0. Blog posts = 0.7. Lower priority pages = 0.5.
- Changefreq: How often you update each page. Homepage = daily. Blog = weekly. Static pages = monthly.
Be honest. If your blog only updates monthly, don't say daily. Search engines ignore these hints if they don't match reality, but accurate metadata helps.
Keep Sitemaps Under 50,000 URLs
According to the official sitemap protocol, each sitemap can have a maximum of 50,000 URLs. If you have more, create multiple sitemaps and reference them in a sitemap index file.
Most platforms (Next.js, Shopify, WordPress) handle this automatically. If you're using a manual tool, watch your URL count.
Update Regularly
Your sitemap should stay current. If you add pages, your sitemap should reflect that within days.
- Next.js: Regenerates on every build. Automatic.
- Webflow: Auto-updates when you publish pages. Automatic.
- Shopify: Auto-updates when you add products. Automatic.
- WordPress: Auto-updates with Yoast. Automatic.
- Lovable & Framer: You need to regenerate manually. Set a monthly reminder.
Validate Your Sitemap
Before submitting to Google, validate your sitemap XML. Use the official sitemap validator or paste your sitemap URL into Google Search Console—Google will validate it for you.
Common errors:
- Invalid URLs: URLs must be properly encoded (spaces become
%20) - Missing protocol: URLs must start with
http://orhttps:// - Duplicate URLs: Each URL should appear only once
- Broken links: URLs that return 404 or 5xx errors
If you see errors, most tools will tell you which URLs are problematic. Fix them before resubmitting.
Monitoring Your Sitemap After Submission
Generating a sitemap is the start, not the finish.
After submission, monitor these metrics:
Google Search Console
Go to Sitemaps in Google Search Console. You'll see:
- URLs submitted: How many URLs you listed in your sitemap
- URLs indexed: How many of those URLs Google actually indexed
If indexed is much lower than submitted, you have a problem. Possible causes:
- Pages are blocked by
robots.txtornoindextags - Pages have crawl errors
- Pages are duplicates
- Pages have poor quality signals
Click on the sitemap to see more details. Google will tell you which URLs weren't indexed and why.
Crawl Issues
Check the Coverage report in Google Search Console. This shows:
- Indexed pages: Pages Google successfully crawled and indexed
- Excluded pages: Pages Google found but didn't index (usually by design)
- Errors: Pages Google couldn't crawl (404s, 5xx errors, etc.)
- Warnings: Pages with issues that might affect ranking
If you see errors, fix them. Common fixes:
- Check that URLs in your sitemap actually exist
- Ensure your site isn't blocking Googlebot in
robots.txt - Fix any server errors (5xx)
- Remove duplicate content
Ranking Performance
After 2-4 weeks, check the Performance report in Google Search Console. You should see:
- Impressions: How many times your pages appeared in search results
- Clicks: How many people clicked through from search
- Average position: Where your pages rank on average
- CTR: Click-through rate
If impressions are low, your pages aren't ranking. Possible causes:
- Your content doesn't match search intent
- Your pages have weak authority
- Your keywords are too competitive
- Your technical SEO has issues
For a deeper dive, read our week 1 SEO guide for busy founders and our 100-day SEO playbook.
Common Mistakes (And How to Avoid Them)
Mistake 1: Submitting a Sitemap Without Verifying Your Domain
Google won't accept a sitemap from an unverified domain. Verify your domain in Google Search Console first. It takes 5 minutes.
Mistake 2: Including Pages You Don't Want Indexed
If your sitemap includes pages with noindex tags, Google will ignore them. But you're wasting crawl budget. Remove them from your sitemap.
Mistake 3: Not Updating Your Sitemap
If you add pages to your site but your sitemap is outdated, Google won't find them. Set up auto-generation (Next.js, Webflow, WordPress) or schedule monthly regeneration (Lovable, Framer).
Mistake 4: Creating a Sitemap But Not Submitting It
Generating a sitemap does nothing if you don't tell search engines it exists. Submit it to Google Search Console and Bing Webmaster Tools. Also add it to your robots.txt.
Mistake 5: Ignoring Crawl Errors
If Google reports errors in your sitemap (404s, invalid URLs, etc.), fix them. Errors tell Google your site isn't trustworthy. Clean it up.
Mistake 6: Not Excluding Duplicate Content
If your sitemap includes duplicate pages (like /product and /product/), Google gets confused. Decide which version is canonical, exclude the others from your sitemap, and use canonical tags to point to the main version.
The Technical Difference: Sitemap vs. Robots.txt vs. Crawlability
These three things work together. Understanding the difference matters.
Sitemap: A map of URLs you want indexed. It's optional but recommended. It helps search engines find pages faster.
Robots.txt: Rules you set for how crawlers should behave on your site. It's optional. You use it to block crawlers from wasting time on pages you don't want indexed (like /admin or /api).
Crawlability: Whether a page is technically accessible to search engine crawlers. If a page requires JavaScript to render, or if your server returns 5xx errors, it's not crawlable—no amount of sitemap submission will help.
For a deeper explanation, check our guide on crawlability for founders and our explainer on the difference between indexing and ranking.
The order matters:
- First: Make sure your pages are crawlable (no 5xx errors, no JavaScript-only rendering)
- Second: Create a sitemap listing the pages you want indexed
- Third: Set up
robots.txtto exclude pages you don't want crawled - Fourth: Submit your sitemap to Google and Bing
Do these in order. Skip one and you'll have problems.
What Search Engines Actually See: Googlebot vs. GPTBot vs. ClaudeBot
Your sitemap tells search engines which pages exist. But different crawlers see different things.
Googlebot sees your page one way. GPTBot (OpenAI's crawler) sees it differently. ClaudeBot (Anthropic's crawler) sees it yet another way.
They all use your sitemap to find pages. But they render and analyze them differently. For a technical breakdown of what each crawler actually sees, read our guide on what Googlebot, GPTBot, and ClaudeBot actually see on your site.
The point: a good sitemap gets all three crawlers to your pages. But you need to optimize your content for each one—especially if you want to rank in Google AI Overviews or get cited by ChatGPT.
Shipping Your Sitemap: A Checklist
Before you consider this done, run through this checklist:
- Sitemap generated for your stack (Next.js, Webflow, Shopify, etc.)
- Sitemap is live and accessible at
yourdomain.com/sitemap.xml - Sitemap includes only indexable pages (no login pages, no duplicates)
- Sitemap is valid XML (no errors, proper formatting)
- Domain verified in Google Search Console
- Sitemap submitted to Google Search Console
- Sitemap submitted to Bing Webmaster Tools
- Sitemap referenced in
robots.txt - Monitoring set up (check Coverage and Performance reports weekly)
- Update process defined (auto-generation or monthly regeneration)
Once you've checked all boxes, your sitemap is shipped.
Next Steps: From Sitemap to Ranking
A sitemap gets your pages indexed. It doesn't get them to rank.
For ranking, you need:
- Keyword research: Know what people search for in your space
- Content optimization: Write content that matches search intent
- Link building: Get other sites to link to yours
- Technical SEO: Fix crawl errors, improve site speed, optimize for Core Web Vitals
- User signals: Get clicks from search results (CTR matters)
If you're a founder who shipped but lacks organic visibility, start with a domain audit. It takes 60 seconds and tells you exactly what's broken. Read our guide on SEO for busy founders: what to skip, what to ship this week for a concrete plan.
Or if you want a complete SEO foundation in one shot—domain audit, keyword roadmap, 100 AI-generated blog posts—check out Seoable. It's $99, one-time, and ships in under 60 seconds. No monthly fees. No agency. Just results.
Your sitemap is step one. Ship the rest.
Conclusion: Sitemaps Are Foundational, Not Optional
You shipped your site. But if Google doesn't know what pages exist, you're invisible.
A sitemap fixes that. It's the map you hand to search engines.
The good news: generating a sitemap is trivial. Pick your stack (Next.js, Webflow, Shopify, Lovable, WordPress, or Framer), follow the steps above, and you're done in 30 minutes or less.
The hard part isn't the sitemap. It's the content, the links, and the technical optimization that come after.
But you can't rank if you're not indexed. So ship your sitemap first. Then ship the rest.
Start today. Your organic visibility depends on it.
Get the next
dispatch on Monday.
One email per week with the most important SEO and AEO moves for founders. Unsubscribe in one click.