nuxt.js robots.txt文件多重限制每个用户代理
使用nuxts nuxt-robots 模块如何配置每个用户代理的多项删除。目前我有:
robots: () => {
return {
UserAgent: '*',
Disallow: '/search/',
Sitemap: (req) => `https://${req.headers.host}/sitemap.xml`,
}
},
但是我需要输出:
User-agent: *
Disallow: /search/
Disallow: /testimonials/
User-agent: MJ12bot
Disallow: /search/
Disallow: /testimonials
Using Nuxts nuxt-robots module how do I configure multipe disallows per user agent. Currently I have :
robots: () => {
return {
UserAgent: '*',
Disallow: '/search/',
Sitemap: (req) => `https://${req.headers.host}/sitemap.xml`,
}
},
but I need to output:
User-agent: *
Disallow: /search/
Disallow: /testimonials/
User-agent: MJ12bot
Disallow: /search/
Disallow: /testimonials
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想要几个元素,则可能需要使用数组。
这样的事情不起作用吗?
就像阵列方法一样: https://github.com/fengsi-io oio/nuxt-robots #array
If you want several elements, you probably need to use an array.
Isn't something like this working?
Like the array approach: https://github.com/fengsi-io/nuxt-robots#array
您可以通过将不允许路径指定为机器人配置中的数组来实现这一目标。
该配置的输出将是:
You can achieve this by specifying the Disallow paths as an array within the robots configuration.
The output from this configuration will be: