htmlLimitedBots 配置项允许您指定一个用户代理列表,这些用户代理将接收阻塞元数据,而不是流式元数据。
import type { NextConfig } from 'next'
const config: NextConfig = {
htmlLimitedBots: /MySpecialBot|MyAnotherSpecialBot|SimpleCrawler/,
}
export default configmodule.exports = {
htmlLimitedBots: /MySpecialBot|MyAnotherSpecialBot|SimpleCrawler/,
}Next.js 包含一个 HTML 受限机器人的默认列表,包括:
您可以在此处查看完整列表。
指定 htmlLimitedBots 配置项将覆盖 Next.js 的默认列表。然而,这是一种高级行为,在大多数情况下,默认设置应已足够。
const config: NextConfig = {
htmlLimitedBots: /MySpecialBot|MyAnotherSpecialBot|SimpleCrawler/,
}
export default configmodule.exports = {
htmlLimitedBots: /MySpecialBot|MyAnotherSpecialBot|SimpleCrawler/,
}要完全禁用流式元数据:
import type { NextConfig } from 'next'
const config: NextConfig = {
htmlLimitedBots: /.*/,
}
export default configmodule.exports = {
htmlLimitedBots: /.*/,
}| 版本 | 变更 |
|---|---|
| 15.2.0 | 引入 htmlLimitedBots 选项。 |