Initialize Your Project →
Set up your Sitemap.xml workspace in under 2 minutes. Follow this guide to install the CLI, generate your configuration, and verify your first crawl.
Prerequisites
Before initializing your project, ensure your environment meets the following requirements:
- Node.js v18.0 or higher
- Package Manager: npm, pnpm, or yarn
- Terminal Access with execution permissions
- Active Internet Connection for CLI installation & API validation
💡 Tip: If you're migrating from an older version, run
npx sitemap doctor before initializing to audit legacy configurations.
Step 1: Install the CLI
Install the Sitemap.xml command-line interface globally or as a dev dependency in your project:
Terminal
npm install -D @sitemap/cli # or pnpm add -D @sitemap/cli # or yarn add -D @sitemap/cli
Verify the installation by checking the version:
Terminal
npx sitemap --version # Output: 2.4.0
Step 2: Run the Init Command
Navigate to your project root and execute the initialization command. The CLI will scaffold the necessary configuration files:
Terminal
npx sitemap init # ? Select your platform: [Use arrows] # > Generic / Custom # Next.js # Shopify # WordPress # ? Enter base URL: https://example.com # ✔ Configuration written to sitemap.config.js
Step 3: Review & Configure
The CLI generates a sitemap.config.js file in your project root. Open it to customize crawl rules, frequency tags, and indexing priorities:
sitemap.config.js
export default { baseURL: 'https://example.com', crawl: { depth: 5, concurrency: 10, ignore: ['/**/*.pdf', '/admin/**'] }, output: { format: 'xml', compression: true, gzip: true }, indexing: { autoSubmit: true, engines: ['google', 'bing', 'yandex'] } };
Step 4: Run & Verify
Trigger your first crawl and submission pipeline:
Terminal
npx sitemap crawl && npx sitemap submit # 🔍 Discovering URLs... # ✔ Found 142 public pages # 📦 Generating sitemap.xml.gz... # 🚀 Submitted to 3 search engines # ✅ All requests queued successfully
⚠️ Note: First-time submissions may take 2–5 minutes to propagate across search engine consoles. Use
npx sitemap status to monitor indexing progress.
Troubleshooting
- Permission denied: Run with elevated privileges or check directory write permissions.
- Invalid baseURL: Ensure the URL includes a protocol (
https://) and matches your production domain. - API rate limits: Configure
throttle: { delay: 200 }in your config for strict CORS environments.