Добавлена микроразметка для улучшения SEO на страницах каталога, карточки товара, о компании и контактов. Внедрены схемы Organization, Product, BreadcrumbList и LocalBusiness для соответствующих страниц. Обновлены компоненты для поддержки новых атрибутов микроразметки.
This commit is contained in:
@ -26,17 +26,35 @@ const CatalogInfoHeader: React.FC<CatalogInfoHeaderProps> = ({
|
||||
<div className="w-layout-blockcontainer container info w-container">
|
||||
<div className="w-layout-vflex flex-block-9">
|
||||
{breadcrumbs && breadcrumbs.length > 0 && (
|
||||
<div className="w-layout-hflex flex-block-7">
|
||||
<div
|
||||
className="w-layout-hflex flex-block-7"
|
||||
itemScope
|
||||
itemType="https://schema.org/BreadcrumbList"
|
||||
>
|
||||
{breadcrumbs.map((bc, idx) => (
|
||||
<React.Fragment key={idx}>
|
||||
{idx > 0 && <div className="text-block-3">→</div>}
|
||||
{bc.href ? (
|
||||
<a href={bc.href} className="link-block w-inline-block">
|
||||
<div>{bc.label}</div>
|
||||
<a
|
||||
href={bc.href}
|
||||
className="link-block w-inline-block"
|
||||
itemProp="itemListElement"
|
||||
itemScope
|
||||
itemType="https://schema.org/ListItem"
|
||||
>
|
||||
<div itemProp="name">{bc.label}</div>
|
||||
<meta itemProp="position" content={String(idx + 1)} />
|
||||
<meta itemProp="item" content={bc.href} />
|
||||
</a>
|
||||
) : (
|
||||
<span className="link-block-2 w-inline-block">
|
||||
<div>{bc.label}</div>
|
||||
<span
|
||||
className="link-block-2 w-inline-block"
|
||||
itemProp="itemListElement"
|
||||
itemScope
|
||||
itemType="https://schema.org/ListItem"
|
||||
>
|
||||
<div itemProp="name">{bc.label}</div>
|
||||
<meta itemProp="position" content={String(idx + 1)} />
|
||||
</span>
|
||||
)}
|
||||
</React.Fragment>
|
||||
|
@ -95,7 +95,12 @@ const CatalogProductCard: React.FC<CatalogProductCardProps> = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="w-layout-vflex flex-block-15-copy" data-article-card="visible">
|
||||
<div
|
||||
className="w-layout-vflex flex-block-15-copy"
|
||||
data-article-card="visible"
|
||||
itemScope
|
||||
itemType="https://schema.org/Product"
|
||||
>
|
||||
<div
|
||||
className={`favcardcat ${isItemFavorite ? 'favorite-active' : ''}`}
|
||||
onClick={handleFavoriteClick}
|
||||
@ -113,7 +118,15 @@ const CatalogProductCard: React.FC<CatalogProductCardProps> = ({
|
||||
|
||||
{/* Делаем картинку и контент кликабельными для перехода на card */}
|
||||
<Link href={cardUrl} className="div-block-4" style={{ textDecoration: 'none', color: 'inherit' }}>
|
||||
<img src={displayImage} loading="lazy" width="Auto" height="Auto" alt="" className="image-5" />
|
||||
<img
|
||||
src={displayImage}
|
||||
loading="lazy"
|
||||
width="Auto"
|
||||
height="Auto"
|
||||
alt={title}
|
||||
className="image-5"
|
||||
itemProp="image"
|
||||
/>
|
||||
<div className="text-block-7">{discount}</div>
|
||||
</Link>
|
||||
|
||||
@ -122,12 +135,18 @@ const CatalogProductCard: React.FC<CatalogProductCardProps> = ({
|
||||
{priceElement ? (
|
||||
<div className="text-block-8">{priceElement}</div>
|
||||
) : (
|
||||
<div className="text-block-8">{price}</div>
|
||||
<div className="text-block-8" itemProp="offers" itemScope itemType="https://schema.org/Offer">
|
||||
<span itemProp="price">{price}</span>
|
||||
<meta itemProp="priceCurrency" content={currency} />
|
||||
</div>
|
||||
)}
|
||||
<div className="text-block-9">{oldPrice}</div>
|
||||
</div>
|
||||
<div className="text-block-10">{title}</div>
|
||||
<div className="text-block-11">{brand}</div>
|
||||
<div className="text-block-10" itemProp="name">{title}</div>
|
||||
<div className="text-block-11" itemProp="brand" itemScope itemType="https://schema.org/Brand">
|
||||
<span itemProp="name">{brand}</span>
|
||||
</div>
|
||||
<meta itemProp="sku" content={articleNumber || ''} />
|
||||
</Link>
|
||||
|
||||
{/* Обновляем кнопку купить */}
|
||||
|
20
src/components/JsonLdScript.tsx
Normal file
20
src/components/JsonLdScript.tsx
Normal file
@ -0,0 +1,20 @@
|
||||
import React from 'react';
|
||||
import { generateJsonLdScript } from '@/lib/schema';
|
||||
|
||||
interface JsonLdScriptProps {
|
||||
schema: object;
|
||||
}
|
||||
|
||||
// Компонент для вставки JSON-LD разметки
|
||||
const JsonLdScript: React.FC<JsonLdScriptProps> = ({ schema }) => {
|
||||
return (
|
||||
<script
|
||||
type="application/ld+json"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: generateJsonLdScript(schema)
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default JsonLdScript;
|
Reference in New Issue
Block a user