strapi-sitemap-generator
v0.2.0
Published
Plugin to generate sitemap in Strapi V5 Project
Readme
Strapi Sitemap Generator
Generate and serve XML sitemaps in Strapi v5 with a simple admin UI.
Features
- Admin UI for selecting content types with
slug - Custom URL patterns, priority and change frequency per type
- Live URL preview for custom paths
- One-click Generate with live toast feedback
- Preview XML in a new tab
- Public endpoint:
/api/strapi-sitemap-generator/sitemap.xml - Robust service with logging and safe fallbacks
Quick Start
- Enable plugin in Strapi (already enabled in
config/plugins.ts) - Open the plugin in Strapi Admin → "Sitemap Generator"
- Set Base URL (e.g.,
https://yourdomain.com) - Select content types to include
- Configure custom paths (optional)
- Click "Generate Sitemap" and "Preview XML"
Custom URL Configuration
For each selected content type, you can customize how URLs are generated:
Default Behavior
If no custom path is specified, URLs use the plural name:
- Content type:
articles→ URL:https://yourdomain.com/articles/[slug] - Content type:
pages→ URL:https://yourdomain.com/pages/[slug]
Custom Path Examples
Root URLs (no prefix): Set custom path to
/- Result:
https://yourdomain.com/[slug] - Use case: Top-level pages like "About", "Contact"
- Result:
Different prefix: Set custom path to
/blog(when content type isarticles)- Result:
https://yourdomain.com/blog/[slug] - Use case: Aligning with frontend routes that differ from Strapi collection names
- Result:
Nested paths: Set custom path to
/resources/guides- Result:
https://yourdomain.com/resources/guides/[slug]
- Result:
SEO Settings
- Priority (0.0 - 1.0): Indicates importance relative to other URLs (default: 0.7)
- Change Frequency: How often content updates (default: monthly)
Notes
- Only content types with a
slugfield are available - Only entries with a
slugvalue are included in the sitemap - Generation saves config, then builds the sitemap from selected content types
- Search engines fetch the XML via the public endpoint (no download button needed)
Endpoints
- Public sitemap:
/api/strapi-sitemap-generator/sitemap.xml - Admin preview data:
GET /strapi-sitemap-generator/data - Admin config:
GET/PUT /strapi-sitemap-generator/config - Admin content types:
GET /strapi-sitemap-generator/content-types
