• Home
  • Blog
  • XML Sitemap: What it is & How to Create it? With Example

XML Sitemap: What it is & How to Create it? With Example

If you want search engines to find and index your pages faster, an XML sitemap is one of the simplest things you can set up. It works like a clean list of your important URLs that helps Google understand what exists on your site, what’s new, and what should be crawled. 

This matters even more when you publish new pages often, run a large website, or have pages that are not easily reachable through internal links. 

In short, an XML sitemap supports better discovery and smoother indexing. Below, you’ll learn what is a sitemap and how to create XML sitemap the right way, so your content gets a fair chance to appear in search results.

What is XML Sitemap?

An XML sitemap is a file that lists the web pages you want search engines to discover and crawl. It contains the URL of each page and may also include details like the last updated date, how often it changes, and its importance compared to other pages. 

The file is written in XML because XML is a structured format that machines can read easily and consistently. Search engines don’t need to guess your site structure when they have a sitemap; they can quickly understand what content exists, what has been updated recently, and which URLs you consider important.

XML Sitemap Format and Structure

A standard XML sitemap follows a structured format that search engines can easily read. Below is a basic XML sitemap format using the most common tags.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://www.example.com/</loc>
    <lastmod>2025-01-10</lastmod>
    <priority>1.0</priority>
  </url>
</urlset>

Components:

  • <urlset>: The root tag that tells search engines this file is a sitemap.

  • <url>: Wraps information for a single page URL.

  • <loc>: The exact URL of the page you want search engines to crawl and index.

  • <lastmod>: Shows the last updated date of the page. This helps search engines know when content has changed.

  • <priority>: Indicates the relative importance of a page compared to other URLs on your site (range: 0.0 to 1.0). It does not affect rankings directly.

Digital Marketing Course

XML Sitemap Example

Below is a sample XML sitemap example based on key pages of wscubetech.com (for explanation purposes):

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

  <url>
    <loc>https://www.wscubetech.com/</loc>
    <lastmod>2025-01-12</lastmod>
    <priority>1.0</priority>
  </url>

  <url>
    <loc>https://www.wscubetech.com/blog</loc>
    <lastmod>2025-01-11</lastmod>
    <priority>0.9</priority>
  </url>

  <url>
    <loc>https://www.wscubetech.com/digital-marketing-course</loc>
    <lastmod>2025-01-10</lastmod>
    <priority>0.8</priority>
  </url>

  <url>
    <loc>https://www.wscubetech.com/python-course</loc>
    <lastmod>2025-01-09</lastmod>
    <priority>0.8</priority>
  </url>

</urlset>

This example shows how important pages are listed clearly so search engines can discover and crawl them efficiently.

How XML Sitemap Works?

Below is how the XML sitemap works:

Step 1: You Add Sitemap File to Website

When you add sitemap.xml file to your website, it contains a structured list of important URLs. This file can be created automatically by WordPress plugins, SEO tools, or website platforms. The sitemap acts like a directory of pages you want search engines to pay attention to, especially when your site has many pages or frequent updates.

Step 2: Search Engines Discover the Sitemap

Search engines find your sitemap in a few common ways. You can submit it directly in Google Search Console, add its link in your robots.txt file, or search engines may detect it automatically if it’s in a standard location. 

Once discovered, the sitemap becomes a reliable reference point for your site’s content, helping search engines understand your website better.

Step 3: Crawlers Read URLs and Decide What to Crawl

After discovering the sitemap, search engine crawlers read the listed URLs and use them as a guide for crawling. They check which pages are new, updated, or important. This does not guarantee every URL will be indexed, but it strongly improves discovery. 

Pages still need to be accessible, valuable, and allowed for indexing, but the sitemap makes sure they are not missed due to weak linking or complex structure.

Step 4: Indexing Happens Based on Page Quality and Signals

Once a page is crawled, the search engine decides if it should be indexed. The sitemap helps the crawler reach the page, but indexing depends on factors like content quality, duplicates, canonical tags, noindex settings, and overall site health. 

If a page is thin, blocked, or duplicated, it may still be excluded. So think of the sitemap as the “map,” not the “ranking tool”—it helps discovery and crawling, while indexing depends on quality and technical signals.


Recommended Professional
Certificates


Benefits of XML Sitemap in SEO

These are the XML sitemap benefits for a website’s SEO:

1. Faster Discovery of New Pages

An XML sitemap helps search engines find new and updated pages quickly, especially when your site publishes content frequently or has pages that are not strongly linked internally.

2. Better Crawling for Large Websites

For websites with hundreds or thousands of URLs, a sitemap acts as a guide that helps search engines crawl important pages without wasting time on irrelevant or duplicate URLs.

Some pages are hard to discover through navigation or internal links. A sitemap ensures such pages are still visible to search engines.

4. Useful for New or Low-Authority Websites

New websites often have few backlinks. An XML sitemap helps search engines understand the site structure early and crawl pages efficiently from the start.

5. Improves Crawl Efficiency

By listing only indexable and important URLs, a sitemap helps search engines focus their crawling resources on pages that matter most.

6. Better Monitoring Through Search Console

Submitting a sitemap allows you to track indexed URLs, errors, and coverage issues in Google Search Console, making technical SEO management easier.

How to Create XML Sitemap for a Website?

Below are the three most practical ways to create XML sitemap for your website. 

Method 1: Create XML Sitemap Using WordPress Plugins

If your website is on WordPress, plugins are the easiest and most reliable way to generate and update sitemaps automatically. Common plugins for it include Yoast SEO, Rank Math, etc. You can use any one.

  • Step 1: Install and activate Yoast SEO
  • Step 2: Go to Yoast Settings → Site Features
  • Step 3: Enable XML Sitemaps
  • Step 4: Click “View XML Sitemap” to open the sitemap URL. Usually it looks like: https://yourwebsite.com/sitemap_index.xml
  • Step 5: Submit the sitemap link in Google Search Console

Method 2: Create XML Sitemap Using Online Tools

If your site is built on HTML, custom code, Shopify-like platforms, or any CMS where plugin access isn’t available, online sitemap generators help.

Step 1: Choose a Sitemap Generator Tool

Search for “XML sitemap generator” or use trusted tools that crawl your website URLs and generate a sitemap file. For example, you can use: https://www.xml-sitemaps.com/.

Step 2: Enter Your Website URL and Start Crawling

Paste your domain and let the tool scan your site. It will collect reachable URLs through internal links.

Step 3: Review URLs Before Downloading

Remove:

  • duplicate URLs
  • filtered URLs
  • tags/search pages
  • thank-you pages
  • parameter URLs

Only keep pages you actually want indexed.

Step 4: Download the Sitemap File

Most tools let you download a sitemap.xml file once the crawl is complete.

Step 5: Upload Sitemap to Your Site Root

Upload it to the root directory using your hosting panel or FTP so it becomes accessible at:

https://yourwebsite.com/sitemap.xml


Upcoming Masterclass

Attend our live classes led by experienced and desiccated instructors of Wscube Tech.


Method 3: Create a Dynamic XML Sitemap for Non-CMS Websites (Developer Method)

If your website is not built on WordPress or any CMS and new pages are added frequently, the best solution is a dynamic XML sitemap. This method ensures every new page gets added to the sitemap automatically—without manual work.

Step 1: Store All Indexable URLs in a Database or Route List

Most non-CMS websites already have a database or routing system where pages are generated dynamically (for example: blog posts, courses, products).

Developers should ensure that:

  • Only indexable URLs are fetched
  • Pages with noindex, redirects, or errors are excluded
  • Canonical URLs are used
  • This database or route list becomes the source for sitemap generation.

Step 2: Create a Server-Side Sitemap Script

Develop a script (commonly in PHP, Node.js, Python, or Java) that:

  • Fetches all valid URLs from the database
  • Formats them into XML sitemap structure
  • Dynamically sets <lastmod> based on the last updated date
  • This script should generate sitemap output on request, not as a static file.

Step 3: Serve Sitemap at a Fixed URL

Configure the server so the dynamic sitemap is accessible at a standard location like: https://yourwebsite.com/sitemap.xml

Even though the sitemap is dynamic, search engines treat it exactly like a static sitemap file as long as:

  • The XML format is valid
  • The response code is 200 OK
  • The file loads fast

Where is Sitemap XML Located?

In most cases, an XML sitemap is placed in a standard, easily accessible location so search engines can find it without difficulty. The most common location is: https://yourwebsite.com/sitemap.xml

Common Sitemap XML Locations:

  • Root domain: /sitemap.xml
  • Sitemap index file (for large sites): /sitemap_index.xml

CMS-generated sitemaps:

WordPress SEO plugins usually create sitemaps like:

  • /sitemap_index.xml
  • /post-sitemap.xml
  • /page-sitemap.xml

How to Submit XML Sitemap in Google Search Console?

Submitting your sitemap helps Google discover and monitor your website’s URLs more efficiently.

Step 1: Open Google Search Console

Log in to Google Search Console and select the correct website property (domain or URL prefix).

Step 2: Go to the Sitemaps Section

From the left-hand menu, click Sitemaps. This is where Google accepts new sitemap submissions and shows sitemap status.

Step 3: Enter Your Sitemap URL

In the “Add a new sitemap” field, enter only the sitemap path, such as: sitemap.xml or sitemap_index.xml

Then click Submit.

Step 4: Check Submission Status

After submission, Google will show:

  • “Success” if the sitemap is valid
  • Errors if there are format or access issues

Fix any reported errors and resubmit if needed.

Step 5: Monitor Coverage and Indexing

Use the Pages and Indexing reports in Search Console to see how many sitemap URLs are indexed and if any pages are excluded.

XML Sitemap Best Practices

1. Include Only Indexable URLs: Add only pages that return 200 OK and are allowed for indexing. Exclude noindex, blocked, redirected, or error pages.

2. Keep Sitemap Updated: Your sitemap should reflect new, updated, and deleted pages. Use automatic or dynamic generation whenever possible.

3. Use Sitemap Index for Large Websites: If your site has more than 50,000 URLs, split them into multiple sitemaps and connect them using a sitemap index file.

4. Avoid Duplicate and Parameter URLs: Do not include duplicate pages, session IDs, or filtered URLs. These waste crawl budget and create indexing confusion.

5. Use Accurate <lastmod> Dates: Update the <lastmod> tag only when real content changes occur. Avoid updating dates without meaningful changes.

6. Place Sitemap in Root Directory: Hosting the sitemap at the root level makes it easier for search engines to discover and crawl.

7. Reference Sitemap in robots.txt: Add your sitemap URL to robots.txt to help search engines locate it faster.

8. Regularly Test Sitemap Health: Use Google Search Console and sitemap checker tools to identify errors, excluded URLs, and crawl issues early.

What is Digital Marketing? What is Email Marketing?
What is PPC? Pay-Per-Click What is 360° Digital Marketing?
What is Google Ads? What is Performance Marketing?

FAQs About XML Sitemap

Is an XML sitemap necessary for SEO?

It is not mandatory, but it is highly recommended. An XML sitemap improves crawl efficiency and ensures important pages are not missed by search engines.

Does an XML sitemap improve rankings?

An XML sitemap does not directly increase rankings. It helps with faster indexing and better crawling, which indirectly supports SEO performance.

How often should an XML sitemap be updated?

Your sitemap should update whenever new pages are added, existing pages are updated, or pages are removed. Automatic updates are ideal.

Can one website have multiple XML sitemaps?

Yes. Large websites can use multiple sitemaps and connect them using a sitemap index file.

Should noindex pages be added to XML sitemap?

No. Pages marked as noindex should not be included because they send conflicting signals to search engines.

What is the maximum limit for URLs in an XML sitemap?

A single sitemap file can contain up to 50,000 URLs or be 50MB in size. Larger sites must split sitemaps.

What is the role of priority in XML sitemap?

The priority tag shows the relative importance of a page compared to others. Search engines may ignore it, so use it carefully.

How do I check if my sitemap is valid?

You can test your sitemap using Google Search Console or online sitemap checker tools that validate XML structure.

Article by

Virendra Soni

Virendra is the Content & SEO Manager at WsCube Tech. He holds 7+ years of experience in blogging, content marketing, SEO, and editing. With B.Tech. in ECE and working for the IT and edtech industry, Virendra holds expertise in turning web pages into traffic magnets. His mantra? Keep it simple, make it memorable, and yes, let Google fall in love with it.
View all posts by Virendra Soni
Category:
Share This Article
Leave a comment
Your email address will not be published. Required fields are marked *
Comments (0)

No comments yet.

Related articles

Our latest and greatest step-by-step guides on all SEO, AI search, link building, and content marketing.

Top 10 Search Engines in World: Search Engines List 2026

Search engines decide how the world finds information online, and the dominance at the top is not even close. Google…

SEO 17 min read

How to Write a Blog That Ranks on Google? 2026 Guide

If you want to learn how to write blog post, not just as a hobby but as a serious skill…

SEO 19 min read

What is Off-Page SEO? With Top Techniques & Activities

When we talk about ranking a website, off-page SEO becomes one of the most crucial parts of the entire SEO…

SEO 27 min read