コンテンツにスキップ

htmlLimitedBots

htmlLimitedBots設定を使用すると、ストリーミングメタデータではなく、ブロックメタデータを受信するユーザーエージェントのリストを指定できます。

next.config.ts
import type { NextConfig } from 'next'
 
const config: NextConfig = {
  htmlLimitedBots: /MySpecialBot|MyAnotherSpecialBot|SimpleCrawler/,
}
 
export default config

デフォルトリスト

Next.js には、以下を含む HTML 限定ボットのデフォルトリストが含まれています。

  • Google クローラー (例: Mediapartners-Google, AdsBot-Google, Google-PageRenderer)
  • Bingbot
  • Twitterbot
  • Slackbot

完全なリストはこちらをご覧ください: こちら

htmlLimitedBots 設定を指定すると、Next.js のデフォルトリストが上書きされます。ただし、これは高度な動作であり、ほとんどの場合デフォルトで十分です。

next.config.ts
const config: NextConfig = {
  htmlLimitedBots: /MySpecialBot|MyAnotherSpecialBot|SimpleCrawler/,
}
 
export default config

無効化

ストリーミングメタデータを完全に無効にするには

next.config.ts
import type { NextConfig } from 'next'
 
const config: NextConfig = {
  htmlLimitedBots: /.*/,
}
 
export default config

バージョン履歴

バージョン変更履歴
15.2.0htmlLimitedBots オプションが導入されました。