File conventions
Robots metadata route
Crawler instructions only; never use as protection for private data. Source: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/robots
Formal Syntax & Structure
nextjs syntaxnextjs
app/robots.ts → MetadataRoute.RobotsWorking Example
Example Snippetnextjs
import type {MetadataRoute} from 'next';export default function robots():MetadataRoute.Robots { return {rules:{userAgent:'*',allow:'/'},sitemap:'https://books.example/sitemap.xml'};}