Is domain specific config available?
criation opened this issue · 2 comments
criation commented
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 commented
Currently, this module does not support configuration per domain, but you can dynamically generate your robot.txt based on the domain.
quroom commented
@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.