mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
### What? Followup for #47630 , use ts namespace to group MetadataRoute. `MetadataRoute['xxx']` -> `MetadataRoute.xxx` ### Why? namespace is convenient to write for these grouped types such as `MetadataRoute.Robots`. And `MetadataRoute` itself is not actually a type. So it can be conveniently typed by ts users. ### How? Closes NEXT-912 ---------
20 lines
398 B
TypeScript
20 lines
398 B
TypeScript
import type { MetadataRoute } from 'next'
|
|
|
|
export default function robots(): MetadataRoute.Robots {
|
|
return {
|
|
rules: [
|
|
{
|
|
userAgent: 'Googlebot',
|
|
allow: ['/'],
|
|
},
|
|
{
|
|
userAgent: ['Applebot', 'Bingbot'],
|
|
disallow: ['/'],
|
|
crawlDelay: 2,
|
|
},
|
|
],
|
|
sitemap: 'https://example.com/sitemap.xml',
|
|
host: 'https://example.com',
|
|
}
|
|
}
|