Sitemap

From ariadoss/superskills · View interactive version

Sitemap is an AI agent skill from the GitHub repository ariadoss/superskills. When the user wants to create, audit, or optimize sitemap.xml. Also use when the user mentions "sitemap", "sitemap.xml", "sitemap index" or "lastmod". For IndexNow, use indexnow.

How to use this skill

Skill file

SEO Technical: Sitemap

Guides sitemap creation, auditing, and optimization for search engine discovery.

When invoking: On first use, if helpful, open with 1–2 sentences on what this skill covers and why it matters, then provide the main output. On subsequent use or when the user asks to skip, go directly to the main output.

Scope (Technical SEO)

Task

Generate an XML Sitemap that complies with the sitemaps.org protocol from the project's page list, and declare it in robots.txt.

Initial Assessment

Check for project context first: If .claude/project-context.md or .cursor/project-context.md exists, read it for site URL and page structure.

Identify:

  1. Site URL: Base domain (e.g., https://example.com)
  2. URL count: Total indexable pages (single sitemap vs. sitemap index)
  3. Data source: Static config, CMS, file system, or hybrid

1. Protocol Essentials

| Item | Spec |

|------|------|

| Single sitemap limit | 50,000 URLs, 50MB (uncompressed) |

| Sitemap index | When exceeding limit, split and have main index reference sub-sitemaps |

| Encoding | UTF-8 |

| URL format | Full URL, same host, include https:// |

| Required tags | <loc> |

| Optional tags | <lastmod>, <changefreq>, <priority> |

2. Field Requirements

| Field | Description | Recommendation |

|-------|--------------|---------------|

| url | Full URL | https://example.com/path |

| lastModified | Page last modified time | Use page metadata, ISO 8601; use YYYY-MM-DD or omit when no data |

| changeFrequency | Update frequency | Home daily, list pages weekly, content pages monthly |

| priority | Relative importance | Home 1.0, aggregate pages 0.9, content pages 0.7–0.8, others 0.5–0.6 |

lastmod (Critical)

changefreq / priority

3. Architecture & Split

Single Sitemap

Sitemap Index (Multiple Sub-sitemaps)

Multilingual Sites

Multi-Language Sitemap (hreflang in Sitemap)

For multilingual sites, add xhtml:link hreflang alternates inside each <url> entry. Recommended for large sites (100+ multilingual pages); centralizes hreflang management.

Rules:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>https://example.com/page</loc>
    <xhtml:link rel="alternate" hreflang="en" href="https://example.com/page" />
    <xhtml:link rel="alternate" hreflang="zh" href="https://example.com/zh/page" />
    <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/page" />
  </url>
</urlset>

List all language sitemaps in sitemap index; include in robots.txt.

4. Implementation

| Tech Stack | Implementation |

|------------|-----------------|

| Next.js App Router | app/sitemap.ts export MetadataRoute.Sitemap or generateSitemaps |

| Next.js Pages Router | pages/sitemap.xml.ts or getServerSideProps return XML |

| Astro | src/pages/sitemap-index.xml.ts or @astrojs/sitemap |

| Vite / Static build | Build script generates public/sitemap.xml |

| Other | Generate static /sitemap.xml or return dynamically via API |

Route Exclusion

5. Page Scope

Include

Exclude

6. Data Source & Maintenance (Single Source of Truth)

Central Config (Recommended)

Create a config (e.g., site-pages-config.ts) that exports:

Why: Sitemap, IndexNow, and feed can all import from the same config—no duplicate URL maintenance. IndexNow should use the same URL list; avoid separate hardcoded lists.

7. robots.txt

Add to robots.txt:

Sitemap: https://example.com/sitemap.xml

With multiple sitemaps, only declare the main index.

8. Output Format

Single Sitemap Example

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

Sitemap Index Example

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://example.com/sitemap/pages.xml</loc>
    <lastmod>2025-01-15</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://example.com/sitemap/posts.xml</loc>
    <lastmod>2025-01-14</lastmod>
  </sitemap>
</sitemapindex>

9. Common Issues

| Issue | Cause / Fix |

|-------|-------------|

| Sitemap 404 | Build failure, wrong path, incorrect export; check routes and deployment |

| Missing pages | URLs not in data source, filtered or excluded |

| lastmod anomaly | Avoid new Date(); use modifiedDate from page metadata |

| Google not indexing | Submit sitemap in GSC; check Coverage (google-search-console) and robots |

| EN/ZH URL mismatch | Use unified data source; share same list when generating by locale |

References

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.