跳到内容
配置next.config.jshtmlLimitedBots

htmlLimitedBots

htmlLimitedBots 配置允许你指定一个用户代理列表,这些用户代理应该接收阻止元数据而不是流式元数据

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

默认列表

Next.js 包含 HTML 受限机器人的默认列表

指定 htmlLimitedBots 配置将覆盖 Next.js 的默认列表,允许你完全控制哪些用户代理应该选择加入此行为。然而,这是一种高级行为,默认设置对于大多数情况应该足够了。

版本历史

版本变更
15.2.0引入 htmlLimitedBots 选项。