nuxt-modules/robots

Feature Request: Can we have conditional robot.txt generation? like different for development & production.

vishalyadaviit opened this issue · 2 comments

So my requirement is such that I would like to generate robot.txt that block everything for my development platform but only certain things in production.

Hi @nemeton-x
I'll review your request.

Hi @nemeton-x
Try this:

// nuxt.config.js
robots: [
  {
    // all environment
    UserAgent: ['Googlebot', 'Bingbot'], 

    // disallow '/admin', only production
    Disallow: () => (process.env.NODE_ENV !== 'production') ? [] : ['/admin'] 
  }
]