How to Implement Content Signals in Next.js 16 (robots.ts)
How to Implement Content Signals in Next.js 16 (robots.ts)
Declare AI content preferences with Next.js 16.3 and the new other directive map in app/robots.ts.
·Updated on:··
⚡ Next.js Implementation Guides
In-depth Next.js guides covering App Router, RSC, ISR, and deployment. Get code examples, optimization checklists, and prompts to accelerate development.
I was reviewing the crawler access controls on my production site when I realized our robots.txt had no way to signal granular AI preferences. Traditional crawler rules give you only two levers: allow or disallow. Either you permit an automated bot to access your pages entirely, or you lock them out completely. With AI models scanning the web for both live search retrieval and long-term model training, site owners need a way to communicate nuanced permissions.
After researching the emerging Content Signals standard, I ran directly into a framework limitation. Next.js has supported dynamic robots.ts files since version 13, but the framework's internal serializer stripped any directives outside the standard Robots Exclusion protocol. Custom headers like Content-Signal simply vanished from the rendered output.
With Next.js 16.3, the framework introduced an official escape hatch for non-standard directives. In this guide, I will show you how to implement Content Signals directly inside app/robots.ts using the new other directive map, declaring clear preferences for search indexing, live AI answers, and model training.
Understanding Content Signals Directives
Before writing configuration code, we need to understand how Content Signals convey publisher preferences to automated crawlers. Originating from an IETF internet draft and popularized by Cloudflare, Content Signals establish three distinct categories of content usage:
search: Building a search engine index and displaying links and short snippets in search results.
ai-input: Passing website content into an AI system in real time, such as Retrieval-Augmented Generation (RAG) queries, grounded chat answers, or AI search summaries.
ai-train: Ingesting content to train, pre-train, or fine-tune artificial intelligence foundation models.
Each category accepts a simple yes or no value. A directive string combines them in comma-delimited pairs, like this:
Depending on your business goals, you can disallow model training while remaining discoverable in AI search engines, or you can allow full access across all three categories to maximize your presence across AI assistants and web crawlers.
Step 1: Upgrading Next.js to 16.3 or Newer
Next.js added support for custom directives on crawler rules in version 16.3.0. In older releases, the MetadataRoute.Robots TypeScript interface and the underlying string generator only handled userAgent, allow, disallow, and crawlDelay. Any additional keys passed to the rule object were quietly dropped during serialization.
Check your current Next.js version in package.json and ensure it is updated to at least 16.3.0:
With the package upgraded, Next.js will preserve the exact casing of keys declared inside other and render each key-value pair directly beneath the corresponding User-agent block.
Step 2: Configuring Content Signals in app/robots.ts
Now we can implement our rules inside src/app/robots.ts. We want our signals to apply both to generic crawlers via the wildcard * agent and to specific, high-profile AI crawlers such as GPTBot, ClaudeBot, and PerplexityBot.
In this implementation, we define an array of restricted administrative paths and a list of recognized LLM crawler identifiers. We define our contentSignalPolicy variable according to our preferred permissions. In this example, we set ai-train=yes, search=yes, ai-input=yes to invite search engines, citation systems, and AI tools to index and cite our work freely.
Next, we map our rules array. The first rule targets the global wildcard *. The subsequent rules iterate through our list of specific AI user-agents. Inside each rule, we supply the other dictionary with our 'Content-Signal' header.
Because robots.txt parser rules state that crawlers matching a specific user-agent header disregard the generic wildcard block, adding other to each explicit AI bot entry ensures the directive is observed regardless of which block the crawler matches.
Step 3: Verifying the Generated robots.txt Output
Next.js automatically serves the return value of app/robots.ts at the /robots.txt path. You can verify the final serialized text by running your development server or requesting the route directly in your browser.
Notice how Next.js preserves the Content-Signal casing and groups the directive cleanly inside each stanza. The admin paths remain disallowed, the sitemap URL resolves dynamically against your configured domain, and compliant AI scrapers receive unambiguous guidelines on how your content may be consumed.
Conclusion
Controlling how automated agents interact with your content no longer requires an all-or-nothing approach. In this guide, we explored how the Content Signals standard categorizes automated content usage across search indexing, real-time AI input, and model training. We then leveraged the other directive map introduced in Next.js 16.3 to emit type-safe, non-standard directives directly inside app/robots.ts, avoiding the need to write custom route handlers or manage raw static text files.
With this setup in place, your application provides clear, machine-readable preferences for search engines and AI operators while keeping your metadata configuration centralized and maintainable.