禁止使用@ nuxtjs / robots模块的动态URL

问题描述 投票:0回答:1

我具有以下文件夹结构:

/pages/user/_user

以及我当前在nuxt.config中的机器人对象

robots: {
 UserAgent: '*',
 Disallow: '/user',
 Sitemap: 
 'https://www.misite.com/sitemap.xml'
},

我没有在模块的文档中找到任何相关的内容,所以我想知道如何disallow / _user URL?

nuxt.js nuxt
1个回答
0
投票

不确定是否可以使用robots模块,但不要忘记您可以在用户页面上添加noindex标记。

<script>
export default {
  head () {
    return {
      meta: [
        { hid: 'robots', name: 'robots', content: 'noindex' }
      ]
    }
  }
}
</script>
© www.soinside.com 2019 - 2024. All rights reserved.