How to Submit a Sitemap to Google (and Check Whether It Worked)

Sitemaps are the fastest way to tell Google about new pages. This guide walks you through submitting a sitemap in Search Console and checking that Google actually crawled it.

R
Rahim
Author
15 Oct 2026 · 9 min read · 1 views
How to Submit a Sitemap to Google (and Check Whether It Worked)

Why Sitemaps Matter to Developers and Small Sites

A rack of servers in a server room

Push a batch of new product pages and expect Google to crawl them in hours? It won't. Without a sitemap the URLs sit idle for days.

Google respects the crawl budget you hand it. No sitemap means the bot follows only internal links; shallow navigation leaves many pages invisible. Fresh content stays buried, reporting shows zero impressions, and clients wonder why the ads point to dead ends.

Case study: a Shopify-style boutique with 12 k SKUs. We dropped a static XML sitemap—one URL per product—into Search Console. In 48 hours Google indexed 85 % of the new items; a week before it barely scraped anything. The PPC dashboard reflected a 30 % lift in conversions because ads finally hit live pages.

That's not magic; it's a clear map. For small-to-medium sites a sitemap is the cheapest way to steer the bot, protect your crawl budget, and give you solid data for client reports.

Prerequisites: Server, XML, and Google Search Console Access

Gray and black laptop computer on surface

Before you click "Submit", double-check the fundamentals.

  • Valid XML 1.0 – No stray characters, UTF-8 encoding, proper <urlset> root. Google rejects anything that fails schema validation.
  • Correct MIME type – Serve with Content-Type: application/xml (or application/octet-stream if gzipped). A .txt header silently fails.
  • Reachable URL – Publicly accessible, no auth, no IP blocks. Test with curl -I https://example.com/sitemap.xml.
  • HTTPS – Google prefers secure URLs. Even if the site runs on HTTP, serve the sitemap over HTTPS to avoid mixed-content warnings.
  • Verified Search Console property – Ownership via DNS TXT, HTML file, or meta tag; otherwise the UI won't let you add a sitemap.

Optional but helpful: add Sitemap: https://example.com/sitemap.xml to robots.txt. That gives crawlers a hint before you submit.

If you're behind a CDN, remember cached copies can serve stale XML. During development set Cache-Control: max-age=300, then relax it in production.

Step-by-Step: Generating and Submitting the Sitemap

Three common approaches.

1. Manual creation

For a tiny site, hand-craft the file. Open sitemap.xml and paste:

<?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-10-10</lastmod>
 <changefreq>daily</changefreq>
 <priority>1.0</priority>
 </url>
 <!-- repeat for each page -->
</urlset>

2. CMS plugin

WordPress users can rely on Yoast SEO or Rank Math; Shopify ships a built-in sitemap.xml. I usually skip plugins in production because the extra PHP hook can slow page loads; I prefer a build-time generator.

3. CLI script (PHP example)

This snippet scans a folder of static HTML files and writes a minimal sitemap.

<?php
$base = 'https://example.com';
$dir = __DIR__.'/public';
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));
$xml = new SimpleXMLElement('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');

foreach ($files as $file) {
 if ($file->isFile && $file->getExtension === 'html') {
 $path = str_replace($dir, '', $file->getPathname);
 $url = $base. str_replace('\\', '/', $path);
 $urlNode = $xml->addChild('url');
 $urlNode->addChild('loc', $url);
 $urlNode->addChild('lastmod', date('c', $file->getMTime));
 }
}
$xml->asXML(__DIR__.'/sitemap.xml');?>

Run it with php generate-sitemap.php. The file lands in the web root, ready for Google.

Submitting via Search Console UI

  1. Log into Google Search Console and pick your verified property.
  2. Go to Sitemaps under "Index".
  3. Enter the full URL (e.g., https://example.com/sitemap.xml) in "Add a new sitemap".
  4. Click Submit. Google will show "Pending" or "Success".

Submitting via the URL-submission endpoint

If you prefer a one-liner, hit Google's public endpoint:

curl "https://www.google.com/ping?sitemap=https://example.com/sitemap.xml"

A 200 response means Google accepted the URL.

Submitting via the Search Console API

Automation for CI pipelines? Here's a quick curl example with an OAuth token:

curl -X POST \
 -H "Authorization: Bearer YOUR_OAUTH_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"siteUrl":"https://example.com","feedpath":"https://example.com/sitemap.xml"}' \
 "https://searchconsole.googleapis.com/v1/urlNotifications:publish"

Swap YOUR_OAUTH_TOKEN for a token with https://www.googleapis.com/auth/webmasters scope. The JSON response contains type and status.

Quick verification

After any submission, run:

curl -I https://example.com/sitemap.xml

Look for 200 OK and Content-Type: application/xml. Then check robots.txt:

curl https://example.com/robots.txt | grep -i sitemap

If you see the Sitemap: line, you've covered the basics.

Advanced Config: Indexing Controls and Performance Tweaks

Large sites outgrow a single XML file fast. Google caps a sitemap at 50 k URLs or 50 MB uncompressed; when you hit those limits, split and index wisely.

Sitemap index files

An index is just another XML that references multiple sitemaps:

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
 <sitemap>
 <loc>https://example.com/sitemap-products.xml</loc>
 <lastmod>2026-10-10</lastmod>
 </sitemap>
 <sitemap>
 <loc>https://example.com/sitemap-blog.xml</loc>
 <lastmod>2026-10-09</lastmod>
 </sitemap>
</sitemapindex>

Submit the index instead of each child; Google will crawl them all.

Priority and lastmod

Don't over-use <priority>. Google treats it as a hint, not a rule. I set 1.0 only for the homepage and major categories; everything else stays out. <lastmod> must be ISO 8601; if you can't guarantee accuracy, drop the tag—wrong dates mislead the crawler.

Splitting large sites

A 200 k-URL blog? Create one sitemap per 10 k URLs. Name them predictably: sitemap-blog-01.xml, sitemap-blog-02.xml, etc. Reference them in an index file. This keeps each file under the limit and makes debugging easier.

Gzip compression

Google accepts .xml.gz. Serve it with Content-Encoding: gzip. Disk size drops dramatically, which speeds up the initial fetch. Example:

gzip -c sitemap.xml > sitemap.xml.gz

Update the URL in Search Console to point to sitemap.xml.gz. No extra config needed on Google's side.

Cache-busting query strings

If your CI rebuilds the sitemap daily, force a re-fetch by appending a version query:

https://example.com/sitemap.xml?v=20261012

Don't abuse this; Google still respects Cache-Control. Use a query only when the content truly changes.

Sitemap-type parameter for media

Google supports dedicated tags for images, videos, and news. Keep them separate:

  • sitemap-images.xml – uses <image:image> tags.
  • sitemap-videos.xml – includes <video:video> entries.
  • sitemap-news.xml – follows the News sitemap schema.

When you submit, either add ?type=images or list them in the index file; Google parses the correct schema automatically.

Production Pitfalls and How to Diagnose Them

You push "Submit" in Search Console and still get ghosts. The Coverage tab shows why.

Malformed XML. One stray ampersand and Google bounces the whole file. You'll see "Sitemap parsing error". Run it through the W3C validator or fire xmllint --noout sitemap.xml locally. Fix, re-upload, resubmit.

Blocked by robots.txt. If /sitemap.xml or its folder is disallowed, Google never even tries to fetch it. Open URL Inspection → "Robots tested". A quick curl -I https://example.com/robots.txt spells out the rules. Drop the Disallow line or move the sitemap to a public path.

404 response. A typo or a mis-routed rewrite returns "Submitted URL not found (404)". Verify with curl -I https://example.com/sitemap.xml. When a CDN is in play, purge its cache – stale edges love to serve 404s.

Wrong content-type. Google wants application/xml or text/xml. If you send text/html, the crawler treats it like a normal page and skips the XML. curl -I reveals the header. Fix nginx with add_header Content-Type application/xml; or Apache with AddType application/xml.xml.

Duplicate URL entries. Two identical <loc> tags trigger a "duplicate URL" warning. Google still parses, but you waste crawl budget. Spot duplicates with sort sitemap.xml | uniq -d before you push.

After any fix, swing back to Search Console. The Coverage view refreshes in a few hours. Run URL Inspection on the sitemap URL itself – it tells you if Google can fetch, parse, and whether errors linger. Still red? Re-run the curl header check; a rogue CDN node may be serving an old header.

Choosing the Right Submission Method: UI vs API vs Automated Build

Method Setup Time Automation Potential Error Feedback Ideal Use-Case
Search Console UI Minutes None Immediate UI alerts, no programmatic details One-off sites, quick sanity after a redesign
Indexing API Hours (OAuth, token handling) High – callable from CI pipelines JSON response with error codes, rate-limit info Large sites, frequent sitemap churn, scripted retries
Automated Build (gulp/grunt/webpack task that writes sitemap.xml and pings Google) Days (initial script, testing) Full – runs on every deploy CI logs; parse HTTP status from curl Teams with CI/CD, want zero manual steps

Pick the UI if you're a lone dev and rarely touch the sitemap. Opt for the API when you need bulk, programmatic updates – you'll get structured errors and can throttle yourself. Go the automated route if your build already spits out sitemap.xml; a final curl -X GET "https://www.google.com/ping?sitemap=…" does the trick.

FAQ – Technical Questions Developers Ask

Can I submit a sitemap that lives on a different domain?

Yes, but only if that domain belongs to the same Search Console property. Add https://otherdomain.com/sitemap.xml under "Sitemaps" after you've verified ownership of otherdomain.com. Unrelated domains get ignored.

How often should I ping Google after a bulk URL change?

Ping once per batch. Google queues the request and fetches the sitemap within minutes. Hitting the endpoint more than once a minute triggers rate-limiting and can actually slow things down. Bundle thousands of URLs into a single sitemap (or an index) and ping once.

Does gzip affect the indexing speed?

Google accepts gzipped sitemaps and decompresses them on the fly. Bandwidth drops, so the fetch finishes a few seconds sooner on big sites. Parsing speed stays the same. Just set Content-Encoding: gzip correctly; otherwise Google flags the file as corrupt.

What's the difference between a sitemap index and a sitemap file?

A sitemap file holds <url> entries. An index (<sitemapindex>) lists other sitemap files. Use an index when you cross 50 000 URLs or 50 MB uncompressed. Each child sitemap still respects those limits, letting you split by language, type, or update frequency.

How do I handle parameter-driven URLs without creating millions of entries?

Don't enumerate every permutation. List the canonical version with a url tag and let the URL Parameter tool (Crawl > URL Parameters) do the heavy lifting. Mark harmless parameters as "No effect". For pagination, create a small sitemap with the first few pages; deeper pages get discovered via internal links.

Verification Checklist and Next Steps

  1. Run an XML validator; the file must be well-formed.
  2. Confirm curl -I https://example.com/sitemap.xml returns 200 and Content-Type: application/xml.
  3. Submit the URL in Search Console and watch the "Sitemaps" panel for "Success".
  4. Check the Coverage report – look for "Submitted URL has no errors".
  5. Monitor the "Crawl stats" graph for a bump in pages crawled over the next week.

After the checklist, consider sprinkling JSON-LD on the newly surfaced pages. It gives Google richer signals. Set a reminder to glance at Crawl > Crawl stats weekly – a sudden dip usually means a new 404 or a robots rule sneaked in.

Need a hand wiring the Indexing API into your CI pipeline? Our Web Engineering service can build the wrapper. Or drop us a line at Contact and we'll walk through the setup together.

R
Author
Rahim

Software engineer and technology contributor at Epex Logics, specializing in modern web development, performance optimization, and scalable software systems.

Technical Consultation

Ready to build or scale your digital presence?

Whether you need a high-performance web platform, e-commerce re-platforming, or custom application engineering, our team delivers production-ready solutions.

Epex Logics

Typically replies instantly

06:56 AM ✓✓

Start WhatsApp Chat

🔒 Your chat is private & secure