<script>
// --- Schema Article ---
document.addEventListener('DOMContentLoaded', function() {
// Получение базовых данных
const pageTitle = document.title || '';
const pageDescription = document.querySelector('meta[name="description"]')
? document.querySelector('meta[name="description"]').getAttribute('content')
: '';
const pageUrl = window.location.href;
const imageUrl = document.querySelector('meta[property="og:image"]')
? document.querySelector('meta[property="og:image"]').getAttribute('content')
: '';
const authorName = 'Ольга Назаретская'; // Тильда: %%author%%
const publishDate = document.querySelector('meta[itemprop="datePublished"]')
? document.querySelector('meta[itemprop="datePublished"]').getAttribute('content')
: '';
const siteName = 'olganazaretskaia.ru';
// --- Хлебные крошки: задаём релевантные пути ---
const breadcrumbs = [
{
"@type": "ListItem",
"position": 1,
"name": "Главная",
"item": "https://olganazaretskaia.ru/"
},
{
"@type": "ListItem",
"position": 2,
"name": "Глоссарий",
"item": "https://olganazaretskaia.ru/glossary/"
},
{
"@type": "ListItem",
"position": 3,
"name": pageTitle,
"item": pageUrl
}
];
// --- Формирование JSON-LD микроразметки ---
const schemaBreadcrumbs = {
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": breadcrumbs
};
// --- Вставка в <head> ---
[schemaBreadcrumbs].forEach(schemaData => {
const scriptTag = document.createElement('script');
scriptTag.type = 'application/ld+json';
scriptTag.textContent = JSON.stringify(schemaData, null, 2);
document.head.appendChild(scriptTag);
});
});
</script>