nuxt-modules / robots

Tame the robots crawling and indexing your Nuxt site.
https://nuxtseo.com/robots
412 stars 30 forks source link

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

Closed vishalyadaviit closed 5 years ago

vishalyadaviit commented 5 years ago

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.

ricardogobbosouza commented 5 years ago

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

ricardogobbosouza commented 5 years ago

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'] 
  }
]