使用@ nuxtjs / robots模块禁止动态网址

时间:2019-10-08 13:45:05

标签: nuxt.js nuxt

我具有以下文件夹结构:

/pages/user/_user

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

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

我没有发现与模块文档有关的任何内容,所以我想知道如何禁止 / _ user URL?

1 个答案:

答案 0 :(得分:1)

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

<script>
export default {
  head () {
    return {
      meta: [
        { hid: 'robots', name: 'robots', content: 'noindex' }
      ]
    }
  }
}
</script>