Help CenterSEO & AnalyticsHow do I create an XML sitemap for my website?

How do I create an XML sitemap for my website?

An XML sitemap tells search engines about every page on your website and when it was last updated — helping your content get indexed faster and ranked better.

What is an XML Sitemap?

An XML sitemap is a file that lists all the URLs on your website along with metadata like when each page was last updated and how important it is relative to other pages. It is written in XML (a structured data format) and is read by search engine crawlers, not humans.

A typical sitemap entry looks like this:

```xml

<url>

<loc>https://www.example.com/services/web-hosting</loc>

<lastmod>2025-01-15</lastmod>

<changefreq>monthly</changefreq>

<priority>0.8</priority>

</url>

```

Why Sitemaps Matter for SEO

Search engines discover pages by following links. But if a page has few internal links pointing to it, crawlers might miss it. A sitemap guarantees every page gets found.

Sitemaps are especially important for:

  • New websites with few external backlinks
  • Large websites with 100+ pages
  • Pages deep in the site structure
  • Recently published content you want indexed fast

Option 1: WordPress (Automatic via Plugin)

**Yoast SEO (Free):**

Automatically generates a sitemap at `yourdomain.com/sitemap_index.xml`.

  • Go to **Yoast SEO → Features → XML Sitemaps → Enable**
  • Visit your sitemap URL to confirm it works

**Rank Math (Free):**

  • Go to **Rank Math → Sitemap Settings**
  • Enable sitemap and configure what to include
  • Your sitemap is at `yourdomain.com/sitemap.xml`

Option 2: Non-WordPress Sites (Online Generators)

For HTML/CSS websites or custom-built sites:

1. Go to [xml-sitemaps.com](https://www.xml-sitemaps.com)

2. Enter your website URL and click Start

3. Download the generated `sitemap.xml` file

4. Upload it to your website's root directory via FTP or cPanel File Manager

**Limitation:** You need to regenerate and re-upload whenever you add new pages.

Option 3: Generate Programmatically (Developer)

For Next.js or custom web applications, generate the sitemap dynamically:

**Next.js App Router:**

```typescript

// app/sitemap.ts

export default function sitemap() {

return [

{ url: 'https://yourdomain.com', lastModified: new Date() },

{ url: 'https://yourdomain.com/about', lastModified: new Date() },

{ url: 'https://yourdomain.com/services', lastModified: new Date() },

]

}

```

This generates `/sitemap.xml` automatically.

Submitting Your Sitemap to Google

1. Log in to **Google Search Console**

2. Go to **Indexing → Sitemaps**

3. Enter: `sitemap.xml` (or the full path if it is in a subfolder)

4. Click **Submit**

Google will fetch and process your sitemap and report any errors.

Sitemap Best Practices

  • Include only **canonical URLs** — never include duplicate or redirect pages
  • Keep it under **50,000 URLs** (split into multiple sitemaps if larger)
  • Update the `lastmod` date when page content changes
  • Do not include pages with `noindex` meta tags
  • Reference your sitemap in your `robots.txt` file:

```

Sitemap: https://www.yourdomain.com/sitemap.xml

```

Was this article helpful? Contact Support
Still need help?

Raise a support ticket or chat with our team.

Get Support