-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathrobots.ts
More file actions
27 lines (22 loc) · 1.03 KB
/
robots.ts
File metadata and controls
27 lines (22 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { BASE_URL } from '#site/next.constants.mjs';
import type { MetadataRoute } from 'next';
// This allows us to generate a `robots.txt` file dynamically based on the needs of the Node.js Website
// @see https://nextjs.org/docs/app/api-reference/file-conventions/metadata/robots
const robots = (): MetadataRoute.Robots => ({
rules: [
{
userAgent: '*',
disallow: ['/dist/', '/docs/'],
allow: ['/dist/latest/', '/dist/latest/docs/api/', '/api/'],
},
],
sitemap: [`${BASE_URL}/sitemap.xml`, `${BASE_URL}/learn/sitemap.xml`],
});
export default robots;
// Enforces that this route is used as static rendering
// @see https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamic
export const dynamic = 'force-static';
// Ensures that this endpoint is invalidated and re-executed every X minutes
// so that when new deployments happen, the data is refreshed
// @see https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#revalidate
export const revalidate = false;