跳到主要内容

htmlLimitedBots

htmlLimitedBots 配置允许你指定哪些 User-Agent 应该接收阻塞元数据,而不是 流式元数据

next.config.ts
import type { NextConfig } from 'next'

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

export default config

默认列表

Next.js 包含一份默认的 HTML 受限爬虫列表

指定 htmlLimitedBots 配置将覆盖 Next.js 的默认列表,让你可以完全控制哪些 User-Agent 应采用此行为。但这属于高级用法,大多数情况下默认值已足够。

版本历史

VersionChanges
15.2.0引入 htmlLimitedBots 选项。