Skip to content

Commit

Permalink
Merge pull request #29 from Drish-xD/dev
Browse files Browse the repository at this point in the history
Disallow indexing of dev env
  • Loading branch information
Drish-xD authored Apr 28, 2024
2 parents 3117007 + 18148a8 commit 1e93022
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/app/robots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { MetadataRoute } from 'next';
import { APP_URL } from '@/constants';

export default function robots(): MetadataRoute.Robots {
const isProd = process.env.NEXT_PUBLIC_ENVIRONMENT === 'prod';

return {
rules: {
userAgent: '*',
allow: '/',
disallow: ['/_next/', '/images/']
...(isProd && { allow: '/' }),
disallow: isProd ? ['/_next/', '/images/'] : '/'
},
sitemap: `${APP_URL}/sitemap.xml`
sitemap: isProd ? `${APP_URL}/sitemap.xml` : undefined
};
}

0 comments on commit 1e93022

Please sign in to comment.