Add a sitemap and list it in robots.txt
By Chris Hornak · Steps last checked · Part of the Swift Site Audit support pages
The short answer
A sitemap is a file that lists the pages you want search engines to find, usually at yoursite.com/sitemap.xml. Most website builders make one for you. Find yours, then add one line to your robots.txt file, Sitemap: followed by its full address, so every search engine can find it. Then submit it once in Google Search Console.
This page is about the XML sitemap, the file for search engines. It is not a page of links for visitors.
To find your sitemap, open these addresses on your site. The first one that shows a list of links is your sitemap:
yoursite.com/sitemap.xmlyoursite.com/sitemap_index.xml(WordPress with Yoast or Rank Math)yoursite.com/wp-sitemap.xml(WordPress with no SEO plugin)
Then open yoursite.com/robots.txt. A line that starts with Sitemap: tells search engines where the sitemap is. Google calls this line optional. It lets every search engine find your sitemap, not only the ones you submit it to.
Google says a small site with good links between its pages, about 500 pages or fewer, may not need a sitemap. It still helps, and most platforms make one at no cost.
What the audit found
The audit reads the page you tested. Find the line your report shows, then jump to its fix.
No sitemap found
Your report says: Sitemap · No sitemap found
The audit looked at /sitemap.xml, /sitemap_index.xml, /wp-sitemap.xml and any sitemap address your robots.txt names, and none of them answered with a sitemap. The usual causes: the sitemap is switched off (Webflow starts with it off), WordPress's Discourage search engines box is ticked, the site is still private or password protected, or nobody wrote one for a site built in code.
404 Not Found<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2026-12-01</lastmod>
</url>
<url>
<loc>https://example.com/services</loc>
</url>
</urlset>Fix: turn on the sitemap your platform makes, or add one. The steps for your platform are below.
Your sitemap is not listed in robots.txt
Your report says: Sitemap · Sitemap exists but isn't referenced in robots.txt
The sitemap exists, but your robots.txt has no Sitemap: line. Google can still find the sitemap if you submit it in Search Console. Other search engines may not find it. On WordPress this often means someone uploaded a real robots.txt file, which replaces the one WordPress writes with the line in it.
User-agent: *
Disallow: /admin/User-agent: *
Disallow: /admin/
Sitemap: https://example.com/sitemap.xmlFix: add one line to robots.txt: Sitemap: and the full address of your sitemap. Use the address that really opens. On WordPress that is often /wp-sitemap.xml or /sitemap_index.xml, not /sitemap.xml.
Make the change on your platform
Plain code shows first. Pick your platform and we remember it on every support page.
Plain code
A plain file
Save a file named sitemap.xml at the top of your site, so it opens at https://example.com/sitemap.xml. List one <url> per page, with the full address:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2026-12-01</lastmod>
</url>
<url>
<loc>https://example.com/services</loc>
</url>
</urlset>
Then add the line to robots.txt. It can go anywhere in the file:
Sitemap: https://example.com/sitemap.xml
Google ignores <priority> and <changefreq>. It uses <lastmod> only when the dates are right.
Next.js
Make app/sitemap.ts. Next.js serves it at /sitemap.xml:
// app/sitemap.ts
import type { MetadataRoute } from 'next'
export default function sitemap(): MetadataRoute.Sitemap {
return [
{ url: 'https://example.com', lastModified: new Date() },
{ url: 'https://example.com/services', lastModified: new Date() },
]
}
Add sitemap: 'https://example.com/sitemap.xml' to the object app/robots.ts returns.
Source: Google Search Central: Build and submit a sitemap · Next.js: sitemap.xml · Next.js: robots.txt
WordPress
Yoast SEO
Good to know: Yoast's sitemap is at yoursite.com/sitemap_index.xml, and it is on unless someone turned it off. When it is on, Yoast adds the Sitemap: line to robots.txt for you.
No sitemap found
- Go to Yoast SEO › Settings › Site features.
- Under Technical SEO, turn the XML sitemaps switch on. Click View the XML sitemap to check it.
Not listed in robots.txt
A real robots.txt file on your server replaces the one Yoast writes.
- Go to Yoast SEO › Tools › File editor.
- Add
Sitemap: https://yoursite.com/sitemap_index.xmland save.
No File editor? Your site has file editing turned off. Edit the file through your host (see No SEO plugin).
Source: Yoast: XML sitemaps in Yoast SEO · Yoast: The robots.txt file in Yoast SEO
Rank Math
Good to know: Rank Math's sitemap is at yoursite.com/sitemap_index.xml. It replaces the WordPress sitemap and sends /wp-sitemap.xml there.
No sitemap found
- Go to Rank Math SEO › Dashboard and turn on the Sitemap module.
- Open Rank Math SEO › Sitemap Settings. Your sitemap's address is at the top.
Not listed in robots.txt
- Turn on Advanced Mode at the top right of the Rank Math dashboard.
- Go to Rank Math SEO › General Settings › Edit robots.txt.
- Add
Sitemap: https://yoursite.com/sitemap_index.xmland click Save Changes.
Can't edit it? A real robots.txt file on your server overrides Rank Math. Delete that file through your host, then edit here.
Source: Rank Math: Sitemap · Rank Math: Edit robots.txt with Rank Math
No SEO plugin
Good to know: WordPress makes a sitemap at yoursite.com/wp-sitemap.xml, and adds the Sitemap: line to robots.txt for you. There is no sitemap at /sitemap.xml, so don't list that address.
No sitemap found
- Go to Settings › Reading.
- Untick Discourage search engines from indexing this site and save. While it is ticked, WordPress turns the sitemap off.
Still nothing at /wp-sitemap.xml? A plugin or theme may have turned it off. An SEO plugin is the simplest fix: it makes its own sitemap.
Not listed in robots.txt
A real robots.txt file on your server replaces the one WordPress writes.
- Open your host's file manager, or connect by FTP.
- In the site's main folder, open
robots.txtand addSitemap: https://yoursite.com/wp-sitemap.xml. Or delete the file to go back to the WordPress one.
Source: WordPress: wp_sitemaps_get_server() (sitemaps since 5.5) · WordPress: Reading Settings
Squarespace
Good to know: Squarespace makes your sitemap at yoursite.com/sitemap.xml and updates it for you, usually within an hour. You can't edit it, and you can't edit robots.txt.
No sitemap found
Squarespace says: if your site is private or password protected, set your site availability to Public so your sitemap loads.
Not listed in robots.txt
You can't add the line on Squarespace. Submit the sitemap in Google Search Console instead (see Check it worked).
Source: Squarespace: View your site map · Squarespace: How Squarespace optimizes your site for search
Shopify
Good to know: Shopify makes your sitemap at yourstore.com/sitemap.xml and updates it when you add products, pages, collections or blog posts. You can't edit it.
No sitemap found
A store in Private mode blocks visitors and search engines. Go to Online Store › Preferences and look in Store access. Turn private mode off when the store is ready to launch.
Not listed in robots.txt
Shopify's own robots.txt lists your sitemap. If yours doesn't, a theme file called robots.txt.liquid has replaced it. Delete that file to go back to Shopify's version: Online Store › Themes, the … menu, Edit code, then in templates right click robots.txt.liquid and choose Delete permanently. Shopify support can't help with edits to this file.
Source: Shopify Help: Find your sitemap · Shopify Help: Editing robots.txt.liquid · Shopify.dev: robots.txt.liquid
Webflow
Good to know: Webflow's sitemap is off until you turn it on. Once it is on, Webflow adds the Sitemap: line to robots.txt for you. Don't add a second one by hand.
No sitemap found
- Go to Site settings › SEO › Sitemap.
- Set Auto-generate sitemap to Yes.
- Click Save changes, then publish.
Not listed in robots.txt
Go to Site settings › SEO › Indexing. If Remove sitemap.xml from robots.txt is on, turn it off, save and publish.
Source: Webflow Help: Create a sitemap in Webflow · Webflow Help: Set robots.txt rules
Framer
Good to know: Framer makes a sitemap for every published site at yoursite.com/sitemap.xml, and lists it in the robots.txt it writes. Drafts, hidden pages and password protected pages are left out.
No sitemap found
Publish the site. The sitemap appears with the published site.
Not listed in robots.txt
A custom robots.txt you upload (Pro and Enterprise plans) replaces Framer's. Add the line Sitemap: https://yoursite.com/sitemap.xml to your file, upload it again in your domain's Files settings, and publish.
Source: Framer Help: Access the sitemap.xml file · Framer Help: Access your robots.txt file · Framer: WordPress to Framer SEO guide
HubSpot
Good to know: HubSpot makes a sitemap at yoursite.com/sitemap.xml for website pages and blog posts. Landing pages are not added unless you add them.
Add a landing page to the sitemap
- Go to Content › Domains & URLs and open the Sitemap tab.
- Choose your domain, click + Add a page, pick the page and click Add. Changes can take up to 30 minutes.
Not listed in robots.txt
- Click the settings icon in the top bar. In the left sidebar, go to Content › Pages.
- Choose your domain and open the SEO & Crawlers tab.
- In Robots.txt, add
Sitemap: https://yoursite.com/sitemap.xmland click Save.
Source: HubSpot: View and edit a HubSpot-hosted domain sitemap · HubSpot: Prevent content from appearing in search results
Payload or Sanity
Payload
Good to know: Payload has no sitemap setting. The sitemap comes from your site's code. Payload's website template builds it after each deploy with a package called next-sitemap, which also writes robots.txt with the Sitemap: line. If the sitemap is missing, ask your developer to check that step, or to add app/sitemap.ts (see the Code tab).
Source: Payload website template: next-sitemap.config.cjs · Next.js: sitemap.xml
Sanity
Good to know: Sanity has no sitemap setting. The sitemap comes from your site's code. Sanity's own course builds it in Next.js with app/sitemap.ts, reading your pages from Sanity. See the Code tab, or ask your developer.
Check it worked
- Open your sitemap's address in your browser. You should see a list of your pages.
- Open
yoursite.com/robots.txt. Check for aSitemap:line with that same address. - Run the Swift Site Audit again. The Sitemap line should pass.
- In Google Search Console, open the Sitemaps report. Under Add a new sitemap, enter the address and click Submit. The status should read Success. Couldn't fetch means Google couldn't get the file: check the address, and check that robots.txt doesn't block it. Squarespace says a new site can show Couldn't fetch for 24 to 48 hours.
- Optional: in Bing Webmaster Tools, open Sitemaps and click Submit Sitemap.
Common mistakes
- Listing an address that doesn't open. Plain WordPress has no
/sitemap.xml. Open the address before you put it in robots.txt. - A short address. The
Sitemap:line needs the full address, withhttps://. Google says the address must be complete. - The wrong version of your domain. Use the address your site really ends up on, with or without
www, withhttps. - Using the sitemap to hide pages. Leaving a page out doesn't keep it out of Google if other pages link to it. To keep a page out of search, see Fix a noindex tag.
- Blocking the sitemap in robots.txt. Google lists this as a cause of Couldn't fetch.
Fix it yourself, or have us do it
Related
- Fix robots.txt blocking search engines: where the Sitemap line lives
- Fix a noindex tag: the right way to keep a page out of search
- How to audit your website like a buyer would: why search is the first step of a buyer's visit
Sources
Official documentation only. Each link was opened and read on December 5, 2026.


