From 667a581251d0a89c32c61ee05c7dec616b2f1d0a Mon Sep 17 00:00:00 2001 From: Bivekich Date: Sun, 6 Jul 2025 20:23:50 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=20middleware=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=BF=D1=80=D0=B8=D0=BC=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BC=D0=B0=D1=80=D1=88=D1=80=D1=83=D1=82=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B8.=20=D0=A2=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20?= =?UTF-8?q?=D0=BE=D0=BD=20=D0=B8=D1=81=D0=BA=D0=BB=D1=8E=D1=87=D0=B0=D0=B5?= =?UTF-8?q?=D1=82=20=D0=B7=D0=B0=D0=BF=D1=80=D0=BE=D1=81=D1=8B=20=D0=BA=20?= =?UTF-8?q?API,=20=D1=81=D1=82=D0=B0=D1=82=D0=B8=D1=87=D0=B5=D1=81=D0=BA?= =?UTF-8?q?=D0=B8=D0=BC=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=D0=BC=20=D0=B8=20?= =?UTF-8?q?=D0=BC=D0=B5=D1=82=D0=B0=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D0=BC,?= =?UTF-8?q?=20=D1=87=D1=82=D0=BE=20=D1=83=D0=BB=D1=83=D1=87=D1=88=D0=B0?= =?UTF-8?q?=D0=B5=D1=82=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA?= =?UTF-8?q?=D1=83=20=D0=B7=D0=B0=D0=BF=D1=80=D0=BE=D1=81=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=B8=20=D0=BF=D0=BE=D0=B2=D1=8B=D1=88=D0=B0=D0=B5=D1=82=20?= =?UTF-8?q?=D0=B3=D0=B8=D0=B1=D0=BA=D0=BE=D1=81=D1=82=D1=8C=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D1=8B=20=D1=81=20=D0=BF=D1=80=D0=B8=D0=BB?= =?UTF-8?q?=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/robots.ts | 25 +++++++++++++++++++++++++ src/app/sitemap.ts | 18 ++++++++++++++++++ src/middleware.ts | 12 +++++++++++- 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/app/robots.ts create mode 100644 src/app/sitemap.ts 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