schema.org для сайта
Последние записи
Размечаем данные о компании по schema.org (http://schema.org/LocalBusiness и http://schema.org/Organization)
Основная компания с микрораметкой
<div rel="nofollow" itemscope itemtype="http://schema.org/LocalBusiness" href="tel:+77777777777">
<span itemprop="name">Ваша организация</span>
<img itemprop="logo" alt="Логотип" title="Логотип" src="https://site.ru/upload/aspro.mshop/65a/65a3d5310d7569769c463d2a40ef86cc.png" />
<link itemprop="url" href="https://site.ru/" />
<meta itemprop="priceRange" content="От 20 RUB">
<meta itemprop="telephone" content="+77777777777">
<meta itemprop="email" content="email@email.ru">
<meta itemprop="faxNumber" content="+7 (999) 999-99-99">
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="postalCode">почтовый_индекс</span>,
<span itemprop="addressCountry">Страна</span>,
<span itemprop="addressRegion">Область</span>,
<span itemprop="addressLocality">Город</span>,
<span itemprop="streetAddress">улица, номер_дома</span>
</div>
</div>
Филиал с микроразметкой
<div itemscope itemtype="http://schema.org/LocalBusiness">
<span itemprop="name">ООО «Компания»</span>
<span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<meta itemprop="postalCode" content="999999">
<meta itemprop="streetAddress" content="улица, дом, офис">
<meta itemprop="addressLocality" content="Москва">
</span>
<span itemprop="telephone">8 (800) 999–99–99</span>
<span itemprop="email">email@email.ru</span>
<time itemprop="openingHours" datetime="Mo-Fr, 9:00−18:00">Пн-Пт, 9:00 – 18:00</time>
<img itemprop="image" src="ссылка на изображение филиала" />
</div>
Микроформат hCard
<div class="vcard">
<div>
<span class="category">Интернет-магазин</span>
<span class="fn org">ООО «Компания»</span>
</div>
<div class="adr">
<span class="locality">г. Москва</span>,
<span class="street-address">улица, дом, офис</span>
</div>
<div>Телефон: <span class="tel">+7 (800) 999–99–99</span></div>
<div>Мы работаем <span class="workhours">ежедневно с 11:00 до 24:00</span>
<span class="url">
<span class="value-title" title="https://site.ru/"> </span>
</span>
</div>
</div>
Размечаем хлебные крошки по schema.org (https://schema.org/BreadcrumbList)
<ul itemscope itemtype="https://schema.org/BreadcrumbList">
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
<a href="/" title="Главная" itemprop="item">
<span itemprop="name">Главная</span>
<meta itemprop="position" content="0">
</a></li>
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
<a href="/razdel/" title="Раздел" itemprop="item">
<span itemprop="name">Раздел</span>
<meta itemprop="position" content="1">
</a></li>
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
<a href="/razdel/podrazdel/" title="Подраздел" itemprop="item">
<span itemprop="name">Подраздел</span>
<meta itemprop="position" content="2">
</a>
</li>
</ul>
Размечаем товар по schema.org (http://schema.org/Product)
<div itemscope itemtype="http://schema.org/Product">
<span itemprop="name">Название_товара</span>
<img src="фото.jpg" itemprop="image" />
<div itemprop="description">Описание_товара</div>
<div>Производитель: <span itemprop="brand">Бренд</span></div>
<div>Модель: <span itemprop="model">Модель</span></div>
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<span itemprop="ratingValue">4</span> //Средний рейтинг
<span itemprop="reviewCount">9</span> //количество оценок
</div>
<meta itemprop="sku" content="4" />
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<meta itemprop="price" content="700" />
<meta itemprop="priceCurrency" content="RUB" />
<meta itemprop="availability" content="http://schema.org/<?=($offer['CAN_BUY'] ? 'InStock' : 'OutOfStock')?>" />
<meta itemprop="priceValidUntil" content="2013-09-14T21:30">
<div itemprop="review" itemscope itemtype="http://schema.org/Review">
<span itemprop="name">Заголовок отзыва</span>
от <span itemprop="author">Имя пользователя</span>,
<meta itemprop="datePublished" content="2021-08-01">
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
<meta itemprop="worstRating" content="1"> //Минимальная оценка
<span itemprop="ratingValue">4</span> //Оценка пользователя
<span itemprop="bestRating">5</span>звезд. //Максимальная оценка
<span itemprop="description">текст_отзыва</span>
</div>
</div>
</div>
Размечаем FaqPage (https://schema.org/FAQPage). Один вопрос - 1 ответ
<div itemscope itemtype="https://schema.org/FAQPage">
<div itemprop="mainEntity" itemscope itemtype="https://schema.org/Question">
<div itemprop="name">Название вопроса</div>
<div itemprop="text">Сам вопрос (можно опустить и оставить только поле name)</div>
<meta itemprop="answerCount" content="1">
<div itemprop="upvoteCount">196</div> //Кол-во проголосовавших за вопрос
<div itemprop="acceptedAnswer" itemscope="" itemtype="http://schema.org/Answer">
<div itemprop="upvoteCount"/>3</div> //Кол-во проголосовавших за ответ
<span itemprop="text">Текст ответа</span>
</div>
</div>
</div>
Размечаем FaqPage (https://schema.org/FAQPage) по json+ld
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [{
"@type": "Question",
"name": "What is the return policy?",
"acceptedAnswer": {
"@type": "Answer",
"text": "<p>Most unopened items in new condition and returned within <strong>90 days</strong> will receive a refund or exchange. Some items have a modified return policy noted on the receipt or packing slip. Items that are opened or damaged or do not have a receipt may be denied a refund or exchange. Items purchased online or in-store may be returned to any store.</p><p>Online purchases may be returned via a major parcel carrier. <a href=http://example.com/returns> Click here </a> to initiate a return.</p>"
}
}, {
"@type": "Question",
"name": "How long does it take to process a refund?",
"acceptedAnswer": {
"@type": "Answer",
"text": "We will reimburse you for returned items in the same way you paid for them. For example, any amounts deducted from a gift card will be credited back to a gift card. For returns by mail, once we receive your return, we will process it within 4–5 business days. It may take up to 7 days after we process the return to reflect in your account, depending on your financial institution's processing time."
}
}]
}
</script>
Размечаем QAPage (https://schema.org/QAPage). Один вопрос - несколько ответов
<div itemscope itemtype="https://schema.org/QAPage">
<div itemscope itemtype="http://schema.org/Question">
<h1 itemprop="name">Название вопроса</h1>
<div itemprop="upvoteCount">196</div>
<div itemprop="text">Сам вопрос (можно опустить и оставить только поле name)</div>
<meta itemprop="answerCount" content="1"> //Всего ответов
<div><time itemprop="dateCreated" datetime="2020-01-20T15:07Z">20 января, 15:03</time></div>
<div itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Имя задавшего вопрос</span></div>
<div itemprop="suggestedAnswer acceptedAnswer" itemscope itemtype="http://schema.org/Answer">
<div itemprop="upvoteCount">Голосов за ответ</div>
<div itemprop="text">Текст ответа</div>
<div>Дата публикации отзыва <time itemprop="dateCreated" datetime="2020-01-20T15:08Z">20 января, 15:08</time></div>
<div itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Имя ответившего</span></div>
</div>
<div itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer">
<div itemprop="upvoteCount">Голосов за ответ</div>
<div itemprop="text">Текст ответа</div>
<div>Дата публикации отзыва <time itemprop="dateCreated" datetime="2020-01-20T15:09Z">20 января, 15:09</time></div>
<div itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Имя ответившего</span></div>
</div>
</div>
</div>
Размечаем статьи по schema.org (https://schema.org/Article) в формате json+ld
<script type="application/ld+json">
{ "@context": "https://schema.org",
"@type": "Article",
"headline": "Extra! Extra! Read alla bout it",
"alternativeHeadline": "This article is also about robots and stuff",
"image": "http://example.com/image.jpg",
"author": "Patrick Coombe",
"award": "Best article ever written",
"editor": "Craig Mount",
"genre": "search engine optimization",
"keywords": "seo sales b2b",
"wordcount": "1120",
"publisher": {
"@type": "Organization",
"name": "Google",
"logo": {
"@type": "ImageObject",
"url": "https://google.com/logo.jpg"
}
},
"url": "http://www.example.com",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://google.com/article"
},
"datePublished": "2015-09-20",
"dateCreated": "2015-09-20",
"dateModified": "2015-09-20",
"description": "We love to do stuff to help people and stuff",
"articleBody": "You can paste your entire post in here, and yes it can get really really long."
}
</script>
Пример вывода скрипта в формате json+ld
в tempate.php
компонента news.detail
<?
$textCleared = $arResult['DETAIL_TEXT'];
$textCleared = strip_tags($textCleared);
$textCleared = str_replace('#rojkovaya#', '' , $textCleared);
$textCleared = str_replace(' ', '' , $textCleared);
$textCleared = str_replace('—', '' , $textCleared);
$textCleared = str_replace('»', '' , $textCleared);
$textCleared = str_replace('«', '' , $textCleared);
$articlesSchema = [
'@context' => "https://schema.org",
'@type' => "Article",
'headline' => $arResult['NAME'],
'image' => $arResult['DETAIL_PICTURE']['SRC'],
'wordCount' => str_word_count($textCleared),
'publisher' => [
'@type' => "Organization",
'name' => "ORGANIZATION_NAME",
'logo' => [
'@type' => "ImageObject",
'url' => "FULL_URL",
]
],
'url' => $APPLICATION->GetCurPage(false),
'mainEntityOfPage' => [
'@type' => 'WebPage',
'@id' => "https://google.com/article",
],
'description' => strip_tags($arResult['PREVIEW_TEXT']),
'articleBody' => $textCleared,
];
if($arResult['PROPERTIES']['AUTHOR']['VALUE']) $articlesSchema['author'] = $arResult['PROPERTIES']['AUTHOR']['VALUE'];
if($arResult['ACTIVE_FROM']) $articlesSchema['datePublished'] = strtolower(FormatDate("Y-m-d", MakeTimeStamp($arResult['ACTIVE_FROM'])));
if($arResult['DATE_CREATE']) $articlesSchema['dateCreated'] = strtolower(FormatDate("Y-m-d", MakeTimeStamp($arResult['DATE_CREATE'])));
if($arResult['TIMESTAMP_X']) $articlesSchema['dateModified'] = strtolower(FormatDate("Y-m-d", MakeTimeStamp($arResult['TIMESTAMP_X'])));
?>
<script type="application/ld+json">
<?=str_replace("'", "\"", CUtil::PhpToJSObject($articlesSchema, false, true));?>
</script>
Комментарии