39 lines
825 B
TypeScript
39 lines
825 B
TypeScript
import { MetadataRoute } from 'next';
|
|
|
|
export default function robots(): MetadataRoute.Robots {
|
|
const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || 'https://canina.ir';
|
|
const isStaging =
|
|
process.env.NEXT_PUBLIC_APP_ENV === 'staging' ||
|
|
process.env.NODE_ENV !== 'production' ||
|
|
baseUrl.includes('stage') ||
|
|
baseUrl.includes('test') ||
|
|
baseUrl.includes('dev');
|
|
|
|
if (isStaging) {
|
|
return {
|
|
rules: {
|
|
userAgent: '*',
|
|
disallow: '/',
|
|
},
|
|
};
|
|
}
|
|
|
|
return {
|
|
rules: {
|
|
userAgent: '*',
|
|
allow: '/',
|
|
disallow: [
|
|
'/dashboard/',
|
|
'/checkout/',
|
|
'/profile/',
|
|
'/api/'
|
|
],
|
|
},
|
|
sitemap: [
|
|
`${baseUrl}/sitemap.xml`,
|
|
`${baseUrl}/sitemap-products.xml`,
|
|
`${baseUrl}/sitemap-categories.xml`,
|
|
],
|
|
};
|
|
}
|