Добавлена микроразметка для улучшения SEO на страницах каталога, карточки товара, о компании и контактов. Внедрены схемы Organization, Product, BreadcrumbList и LocalBusiness для соответствующих страниц. Обновлены компоненты для поддержки новых атрибутов микроразметки.
This commit is contained in:
@ -10,13 +10,26 @@ import AboutProtekInfo from "@/components/about/AboutProtekInfo";
|
||||
import AboutHelp from "@/components/about/AboutHelp";
|
||||
import MetaTags from "@/components/MetaTags";
|
||||
import { getMetaByPath } from "@/lib/meta-config";
|
||||
import JsonLdScript from "@/components/JsonLdScript";
|
||||
import { generateOrganizationSchema, generateBreadcrumbSchema, PROTEK_ORGANIZATION } from "@/lib/schema";
|
||||
|
||||
export default function About() {
|
||||
const metaData = getMetaByPath('/about');
|
||||
|
||||
// Генерируем микроразметку Organization для страницы "О компании"
|
||||
const organizationSchema = generateOrganizationSchema(PROTEK_ORGANIZATION);
|
||||
|
||||
// Генерируем микроразметку BreadcrumbList
|
||||
const breadcrumbSchema = generateBreadcrumbSchema([
|
||||
{ name: "Главная", url: "https://protek.ru/" },
|
||||
{ name: "О компании", url: "https://protek.ru/about" }
|
||||
]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<MetaTags {...metaData} />
|
||||
<JsonLdScript schema={organizationSchema} />
|
||||
<JsonLdScript schema={breadcrumbSchema} />
|
||||
<CatalogInfoHeader
|
||||
title="О компании"
|
||||
breadcrumbs={[
|
||||
|
@ -1,5 +1,7 @@
|
||||
import MetaTags from "../components/MetaTags";
|
||||
import { getMetaByPath, createProductMeta } from "../lib/meta-config";
|
||||
import JsonLdScript from "@/components/JsonLdScript";
|
||||
import { generateProductSchema, convertAvailability, type SchemaOrgProduct } from "@/lib/schema";
|
||||
import { useRouter } from "next/router";
|
||||
import { useEffect, useState, useMemo } from "react";
|
||||
import { useQuery, useLazyQuery } from "@apollo/client";
|
||||
@ -199,6 +201,30 @@ export default function CardPage() {
|
||||
price: allOffers.length > 0 ? Math.min(...allOffers.map(offer => offer.sortPrice)) : undefined
|
||||
}) : getMetaByPath('/card');
|
||||
|
||||
// Генерируем микроразметку Product
|
||||
const productSchema = useMemo(() => {
|
||||
if (!result || allOffers.length === 0) return null;
|
||||
|
||||
const schemaProduct: SchemaOrgProduct = {
|
||||
name: result.name,
|
||||
description: `${result.brand} ${result.articleNumber} - ${result.name}`,
|
||||
brand: result.brand,
|
||||
sku: result.articleNumber,
|
||||
image: mainImageUrl || (result?.partsIndexImages && result.partsIndexImages.length > 0 ? result.partsIndexImages[0].url : undefined),
|
||||
category: "Автозапчасти",
|
||||
offers: allOffers.map(offer => ({
|
||||
price: offer.sortPrice,
|
||||
currency: "RUB",
|
||||
availability: convertAvailability(offer.quantity || 0),
|
||||
seller: offer.type === 'internal' ? 'Protek' : 'AutoEuro',
|
||||
deliveryTime: offer.deliveryTime ? `${offer.deliveryTime} дней` : undefined,
|
||||
warehouse: offer.warehouse || 'Склад'
|
||||
}))
|
||||
};
|
||||
|
||||
return generateProductSchema(schemaProduct);
|
||||
}, [result, allOffers, mainImageUrl]);
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<>
|
||||
@ -226,6 +252,7 @@ export default function CardPage() {
|
||||
ogTitle={metaConfig.ogTitle}
|
||||
ogDescription={metaConfig.ogDescription}
|
||||
/>
|
||||
{productSchema && <JsonLdScript schema={productSchema} />}
|
||||
<InfoCard
|
||||
brand={result ? result.brand : brandQuery}
|
||||
articleNumber={result ? result.articleNumber : searchQuery}
|
||||
|
@ -26,6 +26,8 @@ import toast from 'react-hot-toast';
|
||||
import CartIcon from '@/components/CartIcon';
|
||||
import MetaTags from "@/components/MetaTags";
|
||||
import { getMetaByPath, createCategoryMeta } from "@/lib/meta-config";
|
||||
import JsonLdScript from "@/components/JsonLdScript";
|
||||
import { generateBreadcrumbSchema, generateWebSiteSchema } from "@/lib/schema";
|
||||
|
||||
const mockData = Array(12).fill({
|
||||
image: "",
|
||||
@ -512,9 +514,24 @@ export default function Catalog() {
|
||||
const categoryNameDecoded = decodeURIComponent(categoryName as string || 'Каталог');
|
||||
const metaData = createCategoryMeta(categoryNameDecoded, visibleProductsCount || undefined);
|
||||
|
||||
// Генерируем микроразметку для каталога
|
||||
const breadcrumbSchema = generateBreadcrumbSchema([
|
||||
{ name: "Главная", url: "https://protek.ru/" },
|
||||
{ name: "Каталог", url: "https://protek.ru/catalog" },
|
||||
...(categoryName ? [{ name: categoryNameDecoded, url: `https://protek.ru/catalog?categoryName=${categoryName}` }] : [])
|
||||
]);
|
||||
|
||||
const websiteSchema = generateWebSiteSchema(
|
||||
"Protek - Каталог автозапчастей",
|
||||
"https://protek.ru",
|
||||
"https://protek.ru/search"
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<MetaTags {...metaData} />
|
||||
<JsonLdScript schema={breadcrumbSchema} />
|
||||
<JsonLdScript schema={websiteSchema} />
|
||||
<CatalogInfoHeader
|
||||
title={
|
||||
isPartsAPIMode ? decodeURIComponent(categoryName as string || 'Запчасти') :
|
||||
|
@ -10,13 +10,19 @@ import OrderContacts from "@/components/contacts/OrderContacts";
|
||||
import LegalContacts from "@/components/contacts/LegalContacts";
|
||||
import MetaTags from "@/components/MetaTags";
|
||||
import { getMetaByPath } from "@/lib/meta-config";
|
||||
import JsonLdScript from "@/components/JsonLdScript";
|
||||
import { generateLocalBusinessSchema, PROTEK_LOCAL_BUSINESS } from "@/lib/schema";
|
||||
|
||||
const Contacts = () => {
|
||||
const metaData = getMetaByPath('/contacts');
|
||||
|
||||
// Генерируем микроразметку LocalBusiness для страницы контактов
|
||||
const localBusinessSchema = generateLocalBusinessSchema(PROTEK_LOCAL_BUSINESS);
|
||||
|
||||
return (
|
||||
<>
|
||||
<MetaTags {...metaData} />
|
||||
<JsonLdScript schema={localBusinessSchema} />
|
||||
<InfoContacts />
|
||||
<section className="main">
|
||||
<div className="w-layout-blockcontainer container w-container">
|
||||
|
@ -13,6 +13,8 @@ import NewsAndPromos from "@/components/index/NewsAndPromos";
|
||||
import AboutHelp from "@/components/about/AboutHelp";
|
||||
import MetaTags from "@/components/MetaTags";
|
||||
import { getMetaByPath } from "@/lib/meta-config";
|
||||
import JsonLdScript from "@/components/JsonLdScript";
|
||||
import { generateOrganizationSchema, generateWebSiteSchema, PROTEK_ORGANIZATION } from "@/lib/schema";
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
@ -27,9 +29,19 @@ const geistMono = Geist_Mono({
|
||||
export default function Home() {
|
||||
const metaData = getMetaByPath('/');
|
||||
|
||||
// Генерируем микроразметку для главной страницы
|
||||
const organizationSchema = generateOrganizationSchema(PROTEK_ORGANIZATION);
|
||||
const websiteSchema = generateWebSiteSchema(
|
||||
"Protek - Автозапчасти и аксессуары",
|
||||
"https://protek.ru",
|
||||
"https://protek.ru/search"
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<MetaTags {...metaData} />
|
||||
<JsonLdScript schema={organizationSchema} />
|
||||
<JsonLdScript schema={websiteSchema} />
|
||||
<HeroSlider />
|
||||
<CatalogSection />
|
||||
<div className="w-layout-blockcontainer container w-container">
|
||||
|
Reference in New Issue
Block a user