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
54
site/snippets/sitemap.php
Normal file
54
site/snippets/sitemap.php
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<?= '<?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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue