Версия 1.2.12 В SEO исправлено формирование канонического адреса страницы.
This commit is contained in:
parent
593a620f29
commit
b968cee091
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "vite-react-typescript-starter",
|
"name": "vite-react-typescript-starter",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.2.11",
|
"version": "1.2.12",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@ -4,6 +4,8 @@ Allow: /article/
|
|||||||
|
|
||||||
Disallow: /admin/
|
Disallow: /admin/
|
||||||
Disallow: /admin/*
|
Disallow: /admin/*
|
||||||
|
Disallow: /login/
|
||||||
|
Disallow: /login/*
|
||||||
Disallow: /search
|
Disallow: /search
|
||||||
Disallow: /search*
|
Disallow: /search*
|
||||||
Disallow: /bookmarks
|
Disallow: /bookmarks
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
import { Helmet } from 'react-helmet-async';
|
import { Helmet } from 'react-helmet-async';
|
||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
interface SEOProps {
|
interface SEOProps {
|
||||||
title?: string;
|
title?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
keywords?: string[];
|
keywords?: string[];
|
||||||
image?: string;
|
image?: string;
|
||||||
url?: string;
|
|
||||||
type?: string;
|
type?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14,10 +14,17 @@ export function SEO({
|
|||||||
description = 'Последние новинки искусства, музыки, театра и культурных мероприятий Москвы и Санкт-Петербурга.',
|
description = 'Последние новинки искусства, музыки, театра и культурных мероприятий Москвы и Санкт-Петербурга.',
|
||||||
keywords = ['культура', 'искусство', 'музыка', 'театр', 'кино'],
|
keywords = ['культура', 'искусство', 'музыка', 'театр', 'кино'],
|
||||||
image = '/images/Logo-2.webp',
|
image = '/images/Logo-2.webp',
|
||||||
url = typeof window !== 'undefined' ? window.location.href : '',
|
type = 'website',
|
||||||
type = 'website'
|
|
||||||
}: SEOProps) {
|
}: 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 (
|
return (
|
||||||
<Helmet>
|
<Helmet>
|
||||||
@ -30,7 +37,7 @@ export function SEO({
|
|||||||
<meta property="og:title" content={siteTitle} />
|
<meta property="og:title" content={siteTitle} />
|
||||||
<meta property="og:description" content={description} />
|
<meta property="og:description" content={description} />
|
||||||
<meta property="og:image" content={image} />
|
<meta property="og:image" content={image} />
|
||||||
<meta property="og:url" content={url} />
|
<meta property="og:url" content={canonicalUrl} />
|
||||||
<meta property="og:type" content={type} />
|
<meta property="og:type" content={type} />
|
||||||
<meta property="og:site_name" content="Культура двух Столиц" />
|
<meta property="og:site_name" content="Культура двух Столиц" />
|
||||||
|
|
||||||
@ -44,7 +51,9 @@ export function SEO({
|
|||||||
<meta name="robots" content="index, follow" />
|
<meta name="robots" content="index, follow" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta charSet="UTF-8" />
|
<meta charSet="UTF-8" />
|
||||||
<link rel="canonical" href={url} />
|
|
||||||
|
{/* Canonical */}
|
||||||
|
<link rel="canonical" href={canonicalUrl} />
|
||||||
</Helmet>
|
</Helmet>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user