diff --git a/package.json b/package.json index 8f358a1..9532c1b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vite-react-typescript-starter", "private": true, - "version": "1.2.11", + "version": "1.2.12", "type": "module", "scripts": { "dev": "vite", diff --git a/public/robots.txt b/public/robots.txt index 8c05237..a5a33d9 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -4,6 +4,8 @@ Allow: /article/ Disallow: /admin/ Disallow: /admin/* +Disallow: /login/ +Disallow: /login/* Disallow: /search Disallow: /search* Disallow: /bookmarks diff --git a/src/components/SEO.tsx b/src/components/SEO.tsx index 7378db0..55cd0cd 100644 --- a/src/components/SEO.tsx +++ b/src/components/SEO.tsx @@ -1,11 +1,11 @@ import { Helmet } from 'react-helmet-async'; +import { useLocation } from 'react-router-dom'; interface SEOProps { title?: string; description?: string; keywords?: string[]; image?: string; - url?: string; type?: string; } @@ -14,10 +14,17 @@ export function SEO({ description = 'Последние новинки искусства, музыки, театра и культурных мероприятий Москвы и Санкт-Петербурга.', keywords = ['культура', 'искусство', 'музыка', 'театр', 'кино'], image = '/images/Logo-2.webp', - url = typeof window !== 'undefined' ? window.location.href : '', - type = 'website' + type = 'website', }: SEOProps) { - const siteTitle = title.includes('Культура двух Столиц') ? title : `${title} | Культура двух Столиц`; + const location = useLocation(); + + const baseUrl = 'https://xn--80aefrggdxongffce6aw8g.xn--p1ai'; + const cleanPath = location.pathname; // только путь без query и hash + const canonicalUrl = `${baseUrl}${cleanPath}`; + + const siteTitle = title.includes('Культура двух Столиц') + ? title + : `${title} | Культура двух Столиц`; return ( @@ -30,7 +37,7 @@ export function SEO({ - + @@ -44,7 +51,9 @@ export function SEO({ - + + {/* Canonical */} + ); -} \ No newline at end of file +}