index-shop/site/snippets/sitemap.php
isUnknown 9eb8d08bcc
All checks were successful
Deploy / Deploy to Production (push) Successful in 6s
Add comprehensive SEO optimization
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>
2026-01-16 17:02:27 +01:00

54 lines
1.6 KiB
PHP

<?= '<?xml version="1.0" encoding="UTF-8"?>' ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<?php
$site = site();
$kirby = kirby();
// Static pages
$pages = $site->index()->filterBy('template', 'in', ['home', 'error', 'thanks']);
foreach ($pages as $p) {
foreach ($kirby->languages() as $lang) {
$url = $p->url($lang->code());
?>
<url>
<loc><?= $url ?></loc>
<lastmod><?= $p->modified('c', 'date') ?></lastmod>
<changefreq>monthly</changefreq>
<priority><?= $p->isHomePage() ? '1.0' : '0.8' ?></priority>
<?php foreach ($kirby->languages() as $altLang): ?>
<xhtml:link rel="alternate" hreflang="<?= $altLang->code() ?>" href="<?= $p->url($altLang->code()) ?>" />
<?php endforeach ?>
</url>
<?php
}
}
// Virtual product pages from Shopify
$products = getShopifyProducts();
foreach ($products as $product) {
foreach ($kirby->languages() as $lang) {
$url = $lang->code() == 'fr'
? $site->url() . '/' . $product['handle']
: $site->url() . '/en/' . $product['handle'];
?>
<url>
<loc><?= $url ?></loc>
<lastmod><?= date('c') ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
<?php foreach ($kirby->languages() as $altLang): ?>
<?php
$altUrl = $altLang->code() == 'fr'
? $site->url() . '/' . $product['handle']
: $site->url() . '/en/' . $product['handle'];
?>
<xhtml:link rel="alternate" hreflang="<?= $altLang->code() ?>" href="<?= $altUrl ?>" />
<?php endforeach ?>
</url>
<?php
}
}
?>
</urlset>