LilyTech

How to Create an XML Sitemap and Submit It to Google

Nguyễn Chính Ngọc LiênReviewed byTrần Kim PhượngContent managerLê Mạnh

Create an XML sitemap: a guide to creating one and submitting it to Google

Creating an XML sitemap is a useful way to help search engines discover important pages on your website. A sitemap does not guarantee that pages will be indexed or rank higher, but it gives Google a clear map of your URLs. This is especially helpful for new or large websites, or sites with complex content structures.

This guide explains how to choose a sitemap creation tool, check your XML file, and submit your sitemap through Google Search Console. You’ll also learn which URLs to include, how to handle common errors, and what to review after submission.

What Is an XML Sitemap, and Which Websites Should Use One?

An XML sitemap is a file that lists the URLs a website owner wants search engines to discover and consider. It can also provide additional information, such as when a page was last updated. However, inclusion in a sitemap is only a signal for consideration: Google still decides whether to crawl and index each URL.

An SEO specialist visualizes website structure while learning how to create an XML sitemap
An XML sitemap helps website owners identify important URLs for search engines to discover.

A sitemap is particularly useful for websites with many pages, frequently published content, pages with few internal links, or deep navigation structures. Google may still discover small websites with strong internal linking without a sitemap, but creating and maintaining one is generally a sensible technical SEO practice.

An XML sitemap typically follows a standard structure with tags such as <urlset>, <url>, <loc>, and the optional <lastmod>. URLs should be canonical, accessible, and belong to the correct website. Avoid including redirected pages, error pages, URLs blocked from indexing, or duplicate versions.

Ways to Create an XML Sitemap for Your Website

1. Use Your CMS’s Built-In Feature

Many content management systems generate sitemaps automatically, or let you enable the feature in settings or through an extension. For WordPress, check the sitemap generated by the platform or the SEO plugin you use. Avoid enabling multiple tools if they generate duplicate sitemaps or use conflicting settings. A sitemap is often located at domain.com/sitemap.xml or in a sitemap index that links to multiple files; check the actual URL on your website.

A web development team chooses the right way to create an XML sitemap for a business website
Depending on the platform and website size, businesses can create an XML sitemap using a CMS, a dedicated tool, or a custom system.

2. Use a Sitemap Generator

For static websites or platforms without a built-in feature, you can use an online sitemap generator or website crawler software. Before using one, define which URLs to crawl, set a depth limit if appropriate, and exclude admin areas, test pages, internal search pages, and parameterized URLs with no SEO value. Once the file is generated, upload the sitemap to the root directory or another configured location on your server.

3. Generate It Automatically from a Custom System

E-commerce websites and systems with frequently changing URLs should generate sitemaps automatically from their databases and update them when content is published, edited, or removed. This prevents outdated URL lists, but the process should be tested as part of your deployment workflow. If the number of URLs exceeds the limit for a single sitemap file, split them across multiple files and list those files in a sitemap index. Under common standards, each sitemap file is limited to 50,000 URLs or 50 MB uncompressed.

Whatever method you choose, review the result after you create an XML sitemap and before submitting it. Open the sitemap URL in a browser to confirm that the server returns XML content, not an error page or a standard HTML page.

How to Check a Sitemap Before Submitting It

Before adding your sitemap to Google Search Console, check the following:

A technical specialist reviews URLs and structure before creating an XML sitemap
Checking URLs, response codes, and indexing directives helps ensure your XML sitemap is accurate before submitting it to Google.
  • Correct URLs: Use the right domain, the HTTPS protocol if your website uses it, and the domain version currently in use.
  • URLs return successful responses: Listed pages should be accessible, not redirect to another URL, and not return 404 or 5xx errors.
  • No indexing restrictions: Do not include pages with a noindex tag in your sitemap. Also check your robots.txt settings and canonical tags to avoid conflicting signals.
  • Canonical, non-duplicate URLs: Prioritize canonical versions and remove tracking URLs or filter variations that do not need to be indexed.
  • Reliable update information: Include lastmod only when it accurately reflects a significant change to the content.

You can validate XML syntax with an XML validation tool or your sitemap generator’s built-in checker. If your sitemap has an index, check both the index file and each child sitemap. For multilingual websites or sites with image or video pages, make sure the relevant extensions are structured correctly for your implementation.

How to Submit a Sitemap to Google Search Console

  1. Add and verify your property: Sign in to Google Search Console and select the correct website property. You must verify ownership; make sure the URL prefix, protocol, and domain match the sitemap address.
  2. Open the Sitemaps section: In the navigation bar, select “Sitemaps.”
  3. Enter the path: Enter the sitemap path, such as sitemap.xml, or the path to the sitemap index you checked. If Search Console displays the domain already, you usually only need to enter the path that follows it.
  4. Submit and check the status: Click submit, then review the processing status, the most recent read time, and the number of URLs discovered. Section names and the interface may change between tool versions.
  5. Check important URLs: Use the URL Inspection tool in Search Console to see whether Google can access a page and check its indexing status.

Submitting a sitemap does not mean Google will index every URL right away. If you see an error, read the specific message, fix the file or server configuration, and then resubmit it. If the sitemap is successful but some pages are not indexed, check content quality, internal links, canonicals, accessibility, and noindex directives rather than resubmitting the sitemap repeatedly.

A marketing team member submits an XML sitemap and monitors its status in a search management tool
After creating an XML sitemap, submit the correct path and monitor its processing status in Google Search Console.

Common Errors and How to Fix Them

Sitemap Couldn’t Be Read

Possible causes include an incorrect URL, a server blocking Googlebot, a file that requires a login, a DNS resolution error, or an unstable server response. Open the sitemap in a regular browser, check its response code, and make sure it is publicly accessible. If you recently changed your domain or protocol, update the Search Console property and sitemap path accordingly.

An SEO specialist checks URL errors and fixes issues while creating an XML sitemap
Reviewing broken URLs, duplicate pages, and noindex directives helps resolve XML sitemap issues effectively.

Submitted URLs Are Excluded from the Index

A sitemap helps Google discover URLs; it does not fix thin or duplicate content, incorrect canonicals, or pages marked noindex. Compare the URLs in your sitemap with their canonical URLs, and check robots tags and content quality. If a page has been permanently deleted, remove it from the sitemap rather than leaving a broken URL in the list.

The Sitemap Contains Unnecessary URLs

Product filter pages, internal search results, paginated pages, or parameterized URLs can create many variations. Keep only URLs that are valuable and intended for indexing. When you change your website structure, review the sitemap to make sure it no longer lists old paths.

LilyTech often recommends treating your sitemap as part of your technical SEO workflow, connected to content management and website structure, rather than creating it once and forgetting about it. When configured correctly, a sitemap makes it easier to monitor URLs and identify issues in Search Console.

Conclusion: Keep Your Sitemap Accurate and Useful

Creating an XML sitemap is about more than exporting a list of URLs. The important steps are choosing the right pages, making sure the file is accessible, and keeping it in sync with your website. After submitting it to Google Search Console, monitor its status, fix errors, and check important pages individually. A sitemap helps Google discover content, but it does not replace quality content, strong internal linking, or reliable crawling.

If your business needs help reviewing a sitemap, website structure, or technical SEO processes, contact LilyTech for advice tailored to your current setup and growth goals.

About the author

Nguyễn Chính Ngọc Liên

Nguyễn Chính Ngọc Liên tốt nghiệp Đại học Công nghiệp và có 7 năm kinh nghiệm trong lĩnh vực viết nội dung SEO. Với nền tảng kiến thức chuyên môn cùng kinh nghiệm thực tế, Ngọc Liên tập trung xây dựng những nội dung rõ ràng, hữu ích, chuẩn SEO và đáp ứng nhu cầu tìm kiếm của người đọc.

Chia sẻ kiến thứcLiên hệ Zalo OA