от 100<script>
(function () {
var PAGE_PRICE = '4000'; // Минимальная цена для этой страницы, только число
function getText(selector) {
var el = document.querySelector(selector);
return el ? el.textContent.trim().replace(/\s+/g, ' ') : '';
}
function getMeta(selector) {
var el = document.querySelector(selector);
return el ? (el.getAttribute('content') || '').trim() : '';
}
function toAbsoluteUrl(url) {
if (!url) return '';
try {
return new URL(url, window.location.href).href;
} catch (e) {
return '';
}
}
function addProductSchema() {
var canonicalEl = document.querySelector('link[rel="canonical"]');
var canonicalUrl = toAbsoluteUrl(
canonicalEl ? canonicalEl.href : window.location.href.split('#')[0]
);
var schema = {
'@context': 'https://schema.org',
'@type': 'Product',
name: getText('h1'),
description: getMeta('meta[name="description"]'),
image: toAbsoluteUrl(getMeta('meta[property="og:image"]')),
url: canonicalUrl,
brand: {
'@type': 'Brand',
name: 'M.Arch',
url: 'https://m-arch-clinic.ru/'
},
offers: {
'@type': 'Offer',
price: PAGE_PRICE,
priceCurrency: 'RUB',
availability: 'https://schema.org/InStock',
url: canonicalUrl,
seller: {
'@type': 'MedicalClinic',
name: 'M.Arch',
url: 'https://m-arch-clinic.ru/'
}
}
};
var script = document.createElement('script');
script.type = 'application/ld+json';
script.textContent = JSON.stringify(schema, null, 2);
document.head.appendChild(script);
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', addProductSchema);
} else {
addProductSchema();
}
})();
</script>00 Руб.