Capítulo 217 de 456

htmlLimitedBots

Core Idea

htmlLimitedBots specifies which user agents receive blocking (non-streaming) metadata instead of streaming metadata, ensuring crawlers/social bots that can't handle streamed <head> content still get complete metadata.

Key Concepts

  • htmlLimitedBots: regex config in next.config.ts; matched user agents get blocking metadata.
  • Default list: includes Google crawlers (Mediapartners-Google, AdsBot-Google, Google-PageRenderer), Bingbot, Twitterbot, Slackbot (full list on GitHub).
  • Overrides, doesn't extend: setting this config replaces the default list entirely.
  • Full disable: htmlLimitedBots: /.*/ forces blocking metadata for all user agents, fully disabling streaming metadata.

Code Examples

import type { NextConfig } from 'next'

const config: NextConfig = {
  htmlLimitedBots: /MySpecialBot|MyAnotherSpecialBot|SimpleCrawler/,
}

export default config
  • O que demonstra: adicionar bots customizados à lista que recebe metadata bloqueante (substitui a lista default).

Reference Tables

VersionChanges
15.2.0htmlLimitedBots introduzido.

Anti-patterns

  • Definir a config esperando que ela some com a lista padrão: ela sobrescreve completamente, não estende — inclua os bots padrão manualmente se ainda precisar deles.

Key Takeaways

  1. Comportamento avançado, o default já cobre a maioria dos casos.
  2. Use /.*/ só se quiser desabilitar completamente streaming metadata pra todos os agentes.

Connects To

  • generateMetadata (streaming metadata): funcionalidade cujo fallback bloqueante é controlado por esta config.