Prerequisites

Before you begin, ensure you have the following:

💡 Pro Tip

Generate your API key from the Dashboard → Settings → API Keys section. Keep it secure and never commit it to version control.

Installation

Install the Sitemap.xml SDK using your preferred package manager:

bash
# Using npm npm install @sitemap/sdk # Using yarn yarn add @sitemap/sdk # Using pnpm pnpm add @sitemap/sdk

Quick Start

Initialize the SDK and submit your first sitemap in under 60 seconds:

javascript
import { SitemapClient } from '@sitemap/sdk'; // Initialize with your API key const client = new SitemapClient({ apiKey: process.env.SITEMAP_API_KEY, environment: 'production' // or 'staging'}); // Discover & submit all URLs const result = await client.submit({ url: 'https://example.com', recursive: true, maxUrls: 10000}); console.log(`Indexed ${result.totalUrls} pages in ${result.duration}ms`);
⚠️ Important

Always validate your sitemap in staging before pushing to production. Use the --dry-run flag in the CLI or validate: true in the SDK to preview changes.

Configuration

Create a sitemap.config.json file in your project root to customize behavior:

json
{ "projectId": "proj_x8s9d2f", "baseHost": "https://yourdomain.com", "exclude": [ "/admin/*", "/private/*", "/api/v1/*" ], "include": [ "/blog/*", "/products/*", "/docs/*" ], "priority": { "/": 1.0, "/blog/*": 0.8, "/products/*": 0.9 }, "changeFrequency": "weekly", "autoSubmit": true, "searchEngines": ["google", "bing", "yandex"] }

Environment Setup

Add your credentials to your .env file:

bash
SITEMAP_API_KEY=sk_live_your_secret_key_here SITEMAP_PROJECT_ID=proj_x8s9d2f SITEMAP_ENVIRONMENT=production

Next Steps

Now that you have the basics configured, explore these resources to optimize your workflow:

© 2025 Sitemap.xml. Documentation licensed under CC BY-SA 4.0.