function injectBlogSchema() {
if (window.location.pathname.startsWith('/blog/') && window.location.pathname.length > 6) {
var title = (document.querySelector('h1') || {}).innerText || document.title;
var description = (document.querySelector('meta[name="description"]') || {}).content || '';
var image = (document.querySelector('meta[property="og:image"]') || {}).content || '';
var url = window.location.href;
var schema = {
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": title.trim(),
"description": description,
"image": image,
"url": url,
"author": {
"@type": "Person",
"name": "Nicolette Harper",
"url": "https://www.virtual-cmo.com/about",
"sameAs": ["https://www.linkedin.com/in/nicolette-harper/"]
},
"publisher": {
"@type": "Organization",
"name": "Virtual CMO",
"url": "https://www.virtual-cmo.com",
"logo": {
"@type": "ImageObject",
"url": "https://kajabi-storefronts-production.kajabi-cdn.com/kajabi-storefronts-production/file-uploads/themes/2160943689/settings_images/172aaf-3271-7374-a52a-a4c68d4ed00_Asset_11_1024x-8.png"
}
},
"mainEntityOfPage": {
"@type": "WebPage",
"@id": url
}
};
var el = document.createElement('script');
el.type = 'application/ld+json';
el.textContent = JSON.stringify(schema);
document.head.appendChild(el);
}
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', injectBlogSchema);
} else {
injectBlogSchema();
}