Add comprehensive SEO optimization
All checks were successful
Deploy / Deploy to Production (push) Successful in 6s
All checks were successful
Deploy / Deploy to Production (push) Successful in 6s
Implement complete SEO setup for virtual product pages with: - Meta tags (title, description, canonical, hreflang) - Open Graph protocol for social sharing - Twitter Card tags - Schema.org structured data (JSON-LD) for products - XML sitemap including virtual pages - Dynamic meta tag updates via JavaScript Changes: - Create SEO snippet with all meta tags - Add structured data snippet for products - Generate sitemap.xml with products and hreflang - Update meta tags dynamically when Shopify data loads - Remove noindex/nofollow (was blocking all indexing) - Add product-specific OG tags (price, availability) All pages now properly indexed with correct multilingual setup. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
f69d990349
commit
9eb8d08bcc
8 changed files with 271 additions and 6 deletions
84
site/snippets/structured-data-product.php
Normal file
84
site/snippets/structured-data-product.php
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
/**
|
||||
* Structured Data (JSON-LD) for Product pages
|
||||
* This will be populated by JavaScript after Shopify data is loaded
|
||||
*/
|
||||
?>
|
||||
<script type="application/ld+json" id="product-schema">
|
||||
{
|
||||
"@context": "https://schema.org/",
|
||||
"@type": "Product",
|
||||
"name": "<?= $page->title() ?>",
|
||||
"description": "",
|
||||
"image": [],
|
||||
"offers": {
|
||||
"@type": "Offer",
|
||||
"url": "<?= $page->url() ?>",
|
||||
"priceCurrency": "EUR",
|
||||
"price": "0",
|
||||
"availability": "https://schema.org/InStock",
|
||||
"seller": {
|
||||
"@type": "Organization",
|
||||
"name": "Index.ngo"
|
||||
}
|
||||
},
|
||||
"brand": {
|
||||
"@type": "Organization",
|
||||
"name": "Index.ngo"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
// Update structured data when product loads
|
||||
(function() {
|
||||
const container = document.querySelector('[data-product-loader]');
|
||||
if (!container) return;
|
||||
|
||||
const handle = container.dataset.shopifyHandle;
|
||||
const language = container.dataset.language || 'fr';
|
||||
const isEnglish = language === 'en';
|
||||
|
||||
const cart = new ShopifyCart({
|
||||
domain: 'nv7cqv-bu.myshopify.com',
|
||||
storefrontAccessToken: 'dec3d35a2554384d149c72927d1cfd1b'
|
||||
});
|
||||
|
||||
cart.getProductByHandle(handle).then(product => {
|
||||
if (!product) return;
|
||||
|
||||
const title = isEnglish && product.titleEn?.value ? product.titleEn.value : product.title;
|
||||
const description = isEnglish && product.descriptionEn?.value ? product.descriptionEn.value : product.description;
|
||||
const price = parseFloat(product.priceRange.minVariantPrice.amount);
|
||||
const images = product.images.edges.map(edge => edge.node.url);
|
||||
const availability = product.availableForSale ? 'https://schema.org/InStock' : 'https://schema.org/OutOfStock';
|
||||
|
||||
const schema = {
|
||||
"@context": "https://schema.org/",
|
||||
"@type": "Product",
|
||||
"name": title,
|
||||
"description": description,
|
||||
"image": images,
|
||||
"offers": {
|
||||
"@type": "Offer",
|
||||
"url": window.location.href,
|
||||
"priceCurrency": "EUR",
|
||||
"price": price.toFixed(2),
|
||||
"availability": availability,
|
||||
"seller": {
|
||||
"@type": "Organization",
|
||||
"name": "Index.ngo"
|
||||
}
|
||||
},
|
||||
"brand": {
|
||||
"@type": "Organization",
|
||||
"name": "Index.ngo"
|
||||
}
|
||||
};
|
||||
|
||||
const schemaScript = document.getElementById('product-schema');
|
||||
if (schemaScript) {
|
||||
schemaScript.textContent = JSON.stringify(schema, null, 2);
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue