A sitemap is a structured list of pages that enables web crawlers to find the
pages of a site.
Options
number
default:50
Number of sitemap entries to fetch.
string
Starting
id cursor of the last sitemap entry fetched.string
A valid locale string (ex.
"en-US").Return type
Examples
Using next-sitemap
The following example uses getSitemap with next-sitemap, a popular Next.js library for generating sitemaps.
pages/sitemap.xml.ts
Filtering by pathname
The following example uses thepathnamePrefix option to filter results to only include pages with a pathname beginning with /blog/.
pages/sitemap.xml.ts
Using pagination
The following example uses thelimit and after field to paginate the results of getSitemap 10 entries at a time.
pages/sitemap.xml.ts
Localization
The following example uses thelocale option to fetch the sitemap for a specific locale.
pages/sitemap.xml.ts
getSitemap will return the sitemap for that particular domain.
For example, if in the site settings there is an es locale with a domain of foo.es, then passing es to getSitemap will return the sitemap for foo.es.