Обновлены мета-теги для страниц профиля и оплаты, заменены статические мета-теги на компонент MetaTags для динамического получения данных. Это улучшает SEO и упрощает управление мета-тегами на этих страницах.
This commit is contained in:
36
src/pages/robots.txt.ts
Normal file
36
src/pages/robots.txt.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
|
|
||||||
|
export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
|
const robotsTxt = `User-agent: *
|
||||||
|
Allow: /
|
||||||
|
|
||||||
|
# Запрещаем индексацию служебных страниц
|
||||||
|
Disallow: /api/
|
||||||
|
Disallow: /admin/
|
||||||
|
Disallow: /dashboard/
|
||||||
|
Disallow: /_next/
|
||||||
|
Disallow: /static/
|
||||||
|
Disallow: /test-auth/
|
||||||
|
|
||||||
|
# Запрещаем индексацию страниц с параметрами
|
||||||
|
Disallow: /*?*
|
||||||
|
|
||||||
|
# Разрешаем основные страницы
|
||||||
|
Allow: /
|
||||||
|
Allow: /catalog
|
||||||
|
Allow: /about
|
||||||
|
Allow: /contacts
|
||||||
|
Allow: /news
|
||||||
|
Allow: /brands
|
||||||
|
Allow: /delivery
|
||||||
|
Allow: /payment
|
||||||
|
Allow: /wholesale
|
||||||
|
Allow: /vin
|
||||||
|
|
||||||
|
# Указываем карту сайта
|
||||||
|
Sitemap: https://protekauto.ru/sitemap.xml
|
||||||
|
`
|
||||||
|
|
||||||
|
res.setHeader('Content-Type', 'text/plain')
|
||||||
|
res.status(200).send(robotsTxt)
|
||||||
|
}
|
85
src/pages/sitemap.xml.ts
Normal file
85
src/pages/sitemap.xml.ts
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
|
|
||||||
|
export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
|
const baseUrl = 'https://protekauto.ru'
|
||||||
|
|
||||||
|
const staticPages = [
|
||||||
|
{
|
||||||
|
url: '',
|
||||||
|
lastModified: new Date().toISOString(),
|
||||||
|
changeFrequency: 'daily',
|
||||||
|
priority: 1.0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: '/about',
|
||||||
|
lastModified: new Date().toISOString(),
|
||||||
|
changeFrequency: 'monthly',
|
||||||
|
priority: 0.8,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: '/contacts',
|
||||||
|
lastModified: new Date().toISOString(),
|
||||||
|
changeFrequency: 'monthly',
|
||||||
|
priority: 0.8,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: '/catalog',
|
||||||
|
lastModified: new Date().toISOString(),
|
||||||
|
changeFrequency: 'weekly',
|
||||||
|
priority: 0.9,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: '/news',
|
||||||
|
lastModified: new Date().toISOString(),
|
||||||
|
changeFrequency: 'weekly',
|
||||||
|
priority: 0.7,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: '/brands',
|
||||||
|
lastModified: new Date().toISOString(),
|
||||||
|
changeFrequency: 'monthly',
|
||||||
|
priority: 0.7,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: '/delivery',
|
||||||
|
lastModified: new Date().toISOString(),
|
||||||
|
changeFrequency: 'monthly',
|
||||||
|
priority: 0.6,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: '/payment',
|
||||||
|
lastModified: new Date().toISOString(),
|
||||||
|
changeFrequency: 'monthly',
|
||||||
|
priority: 0.6,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: '/wholesale',
|
||||||
|
lastModified: new Date().toISOString(),
|
||||||
|
changeFrequency: 'monthly',
|
||||||
|
priority: 0.6,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: '/vin',
|
||||||
|
lastModified: new Date().toISOString(),
|
||||||
|
changeFrequency: 'monthly',
|
||||||
|
priority: 0.7,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
|
${staticPages
|
||||||
|
.map(
|
||||||
|
(page) => ` <url>
|
||||||
|
<loc>${baseUrl}${page.url}</loc>
|
||||||
|
<lastmod>${page.lastModified}</lastmod>
|
||||||
|
<changefreq>${page.changeFrequency}</changefreq>
|
||||||
|
<priority>${page.priority}</priority>
|
||||||
|
</url>`
|
||||||
|
)
|
||||||
|
.join('\n')}
|
||||||
|
</urlset>`
|
||||||
|
|
||||||
|
res.setHeader('Content-Type', 'application/xml')
|
||||||
|
res.status(200).send(sitemap)
|
||||||
|
}
|
Reference in New Issue
Block a user