Files
Jiachi LiuandGitHub 3db878629e Fix dynamic sitemap detection (#60356)
### What

Fix bad detection of dynamic route of sitemap metadata route, the swc
AST check should process when the text are detected. But prevuious if
there's text with `generateSitemap` such as comment but not the actual
export it will fail.

### How
Add both checks on metadata loader side and detection helper side

* Only call `generateSitemaps` helper when the export existed
* Fix the helper detection logic (major part of this PR)

Fixes #59698
Closes #60344
Closes NEXT-2007
2024-01-08 14:11:00 +01:00

19 lines
388 B
TypeScript

import 'server-only'
import { MetadataRoute } from 'next'
/* without generateSitemaps */
export default function sitemap(): MetadataRoute.Sitemap {
return [
{
url: 'https://example.com',
lastModified: '2021-01-01',
changeFrequency: 'weekly',
priority: 0.5,
},
{
url: 'https://example.com/about',
lastModified: '2021-01-01',
},
]
}