Configuration Options

    Configuration settings that can improve the developer experience when working with next-sitemap.


    PropertyDescriptionType
    siteUrlBase url of your websitestring
    output (optional)Next.js output modes. Check documentation.standalone, export
    changefreq (optional)Change frequency. Default dailystring
    priority (optional)Priority. Default 0.7number
    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 5000number
    autoLastmod (optional)Add <lastmod/> property. Default truetrue
    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 .nextstring
    outDir (optional)All the generated files will be exported to this directory. Default publicstring
    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
    generateIndexSitemapGenerate index sitemaps. Default trueboolean
    generateRobotsTxt (optional)Generate a robots.txt file and list the generated sitemaps. Default falseboolean
    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 entrystring[]
    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

    Created by: Vishnu Sankar & Contributors. 

    Font From: Fontshare. 

    Website Source.