Обновлен конфиг middleware для применения правил маршрутизации. Теперь он исключает запросы к API, статическим файлам и метаданным, что улучшает обработку запросов и повышает гибкость работы с приложением.
This commit is contained in:
25
src/app/robots.ts
Normal file
25
src/app/robots.ts
Normal file
@ -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',
|
||||
}
|
||||
}
|
18
src/app/sitemap.ts
Normal file
18
src/app/sitemap.ts
Normal file
@ -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,
|
||||
},
|
||||
]
|
||||
}
|
@ -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*'
|
||||
],
|
||||
}
|
Reference in New Issue
Block a user