Configuration Options
Configuration settings that can improve the developer experience when working with next-sitemap.
Property | Description | Type |
---|---|---|
siteUrl | Base url of your website | string |
output (optional) | Next.js output modes. Check documentation. | standalone , export |
changefreq (optional) | Change frequency. Default daily | string |
priority (optional) | Priority. Default 0.7 | number |
sitemapBaseFileName (optional) | The name of the generated sitemap file before the file extension. Default "sitemap" | string |
alternateRefs (optional) | Denote multi-language support by unique URL. Default [] | AlternateRef[] |
sitemapSize(optional) | Split large sitemap into multiple files by specifying sitemap size. Default 5000 | number |
autoLastmod (optional) | Add <lastmod/> property. Default true | true |
exclude (optional) | Array of relative paths (wildcard pattern supported) to exclude from listing on sitemap.xml or sitemap-*.xml . e.g.: ['/page-0', '/page-*', '/private/*'] . Apart from this option next-sitemap also offers a custom transform option which could be used to exclude urls that match specific patterns | string[] |
sourceDir (optional) | next.js build directory. Default .next | string |
outDir (optional) | All the generated files will be exported to this directory. Default public | string |
transform (optional) | A transformation function, which runs for each relative-path in the sitemap. Returning null value from the transformation function will result in the exclusion of that specific path from the generated sitemap list. | async function |
additionalPaths (optional) | Async function that returns a list of additional paths to be added to the generated sitemap list. | async function |
generateIndexSitemap | Generate index sitemaps. Default true | boolean |
generateRobotsTxt (optional) | Generate a robots.txt file and list the generated sitemaps. Default false | boolean |
robotsTxtOptions.transformRobotsTxt (optional) | Custom robots.txt transformer function. (Example: custom-robots-txt-transformer) Default: async(config, robotsTxt)=> robotsTxt | async function |
robotsTxtOptions.policies (optional) | Policies for generating robots.txt .Default: [{ userAgent: '*', allow: '/' }] | IRobotPolicy[] |
robotsTxtOptions.additionalSitemaps (optional) | Options to add additional sitemaps to robots.txt host entry | string[] |
robotsTxtOptions.includeNonIndexSitemaps (optional) | From v2.4x onwards, generated robots.txt will only contain url of index sitemap and custom provided endpoints from robotsTxtOptions.additionalSitemaps . This is to prevent duplicate url submission (once through index-sitemap -> sitemap-url and once through robots.txt -> HOST) Set this option true to add all generated sitemap endpoints to robots.txt Default false (Recommended) | boolean |