Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is domain specific config available? #111

Open
criation opened this issue Nov 13, 2023 · 2 comments
Open

Is domain specific config available? #111

criation opened this issue Nov 13, 2023 · 2 comments

Comments

@criation
Copy link

I do have two domains, lets say

staging.example.com
exmaple.com

now i want to have specific robots setting for each domain. It'd be nice to realize this by config like this:

modules: [
    [...],
    ['@nuxtjs/robots', {
      UserAgent: '*',
      Disallow: '/admin',
      domains: {
        'exmaple.com': [
          { UserAgent: '*' },
          { Disallow: '/dashboard/' },
        ],
        'staging.example.com': [
          { UserAgent: '*' },
          { Disallow: '/' }, 
        ]
      }
    }],
  ],

is something like this already available?

@kenechukwuJosiah
Copy link

Currently, this module does not support configuration per domain, but you can dynamically generate your robot.txt based on the domain.

@quroom
Copy link

quroom commented Apr 30, 2024

@criation Did you solve your problem?
Maybe you can acheive what you want with env.


  robots:
    process.env.STAGE === "production"
      ? {
          rules: [
            {
              UserAgent: "*",
              Allow: "/",
              Disallow: "/admin",
            },
          ],
        }
      : {
          rules: {
            UserAgent: "*",
            Disallow: "/",
          },
        },

I just set STAGE but you can set whatever you want as variable in env file.
And make your code works conditionally based on domians.
I am sure you can acheive what you want in this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants