diff --git a/src/app/robots.ts b/src/app/robots.ts new file mode 100644 index 0000000..a7b676a --- /dev/null +++ b/src/app/robots.ts @@ -0,0 +1,25 @@ +import type { MetadataRoute } from 'next' + +export default function robots(): MetadataRoute.Robots { + return { + rules: [ + { + userAgent: '*', + disallow: '/', + }, + { + userAgent: 'Googlebot', + disallow: '/', + }, + { + userAgent: 'Bingbot', + disallow: '/', + }, + { + userAgent: 'Yandex', + disallow: '/', + }, + ], + sitemap: 'https://admin.protekauto.ru/sitemap.xml', + } +} \ No newline at end of file diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts new file mode 100644 index 0000000..7f89c8b --- /dev/null +++ b/src/app/sitemap.ts @@ -0,0 +1,18 @@ +import type { MetadataRoute } from 'next' + +export default function sitemap(): MetadataRoute.Sitemap { + return [ + { + url: 'https://admin.protekauto.ru', + lastModified: new Date(), + changeFrequency: 'monthly', + priority: 0.1, + }, + { + url: 'https://admin.protekauto.ru/login', + lastModified: new Date(), + changeFrequency: 'monthly', + priority: 0.1, + }, + ] +} \ No newline at end of file diff --git a/src/middleware.ts b/src/middleware.ts index de40f58..0882c38 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -24,5 +24,15 @@ export function middleware(request: NextRequest) { // Указываем, для каких путей применять middleware export const config = { - matcher: ['/api/:path*'], + matcher: [ + /* + * Match all request paths except for the ones starting with: + * - api (API routes) + * - _next/static (static files) + * - _next/image (image optimization files) + * - favicon.ico, sitemap.xml, robots.txt (metadata files) + */ + '/((?!api|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt).*)', + '/api/:path*' + ], } \ No newline at end of file