Unverified Commit 73f50762 authored by Joseph's avatar Joseph Committed by GitHub

docs: fix generateSitemaps returned type signature (#86984)

Closes: https://github.com/vercel/next.js/issues/86959
parent 9be83065
......@@ -363,8 +363,8 @@ export async function generateSitemaps() {
// Next.js 16 - asynchronous id access
export default async function sitemap({ id }) {
const resolvedId = await id // id is now Promise<number>
const start = resolvedId * 50000
const resolvedId = await id // id is now Promise<string>
const start = Number(resolvedId) * 50000
// ...
}
```
......
......@@ -350,7 +350,7 @@ export async function generateSitemaps() {
}
export default async function sitemap(props: {
id: Promise<number>
id: Promise<string>
}): Promise<MetadataRoute.Sitemap> {
const id = await props.id
// Google's limit is 50,000 URLs per sitemap
......@@ -420,7 +420,7 @@ type Sitemap = Array<{
| Version | Changes |
| ---------- | ------------------------------------------------------------ |
| `v16.0.0` | `id` is now a promise that resolves to a number. |
| `v16.0.0` | `id` is now a promise that resolves to a `string`. |
| `v14.2.0` | Add localizations support. |
| `v13.4.14` | Add `changeFrequency` and `priority` attributes to sitemaps. |
| `v13.3.0` | `sitemap` introduced. |
......@@ -33,7 +33,7 @@ export async function generateSitemaps() {
}
export default async function sitemap(props: {
id: Promise<number>
id: Promise<string>
}): Promise<MetadataRoute.Sitemap> {
const id = await props.id
// Google's limit is 50,000 URLs per sitemap
......@@ -76,6 +76,6 @@ export default async function sitemap(props) {
| Version | Changes |
| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `v16.0.0` | The `id` values returned from `generateSitemaps` are now passed as a promise to the sitemap function. |
| `v16.0.0` | The `id` values returned from `generateSitemaps` are now passed as a promise that resolves to a `string` to the sitemap function. |
| `v15.0.0` | `generateSitemaps` now generates consistent URLs between development and production |
| `v13.3.2` | `generateSitemaps` introduced. In development, you can view the generated sitemap on `/.../sitemap.xml/[id]`. For example, `/product/sitemap.xml/1`. |
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment