SEO-Grundlagen und Vorarbeit für Anzeigen
Bisher fehlte alles, womit Suchmaschinen arbeiten: keine robots.txt, keine Sitemap, keine strukturierten Daten. Jetzt: - sitemap.xml zur Laufzeit erzeugt, damit die Produktseiten aus Medusa mit drin sind — eine Erweiterung kennt beim Bauen nur die festen Seiten - robots.txt, die Warenkorb, Kasse und Konto ausnimmt - Organisationsdaten im Layout, Produkt- und Brotkrumendaten auf der Produktseite, damit in der Trefferliste Preis und Verfügbarkeit stehen können statt nur ein blauer Link - jede Seite hat jetzt genau eine h1; im Hero war der Claim eine h2, die Seiten hatten damit gar keine Hauptüberschrift - die Weiterleitung der Startseite ist dauerhaft (301) statt vorübergehend Für Anzeigen: produktdaten.xml als Feed fürs Merchant Center, eine Zeile je Variante, ohne Gutscheine, Patenschaften und Abo. Dazu die Meldung des Kaufabschlusses an Google — nur wenn eingewilligt wurde, und einmal je Bestellung. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import GiftVoucherOptions from "../../components/GiftVoucherOptions.astro";
|
||||
import { getProductByHandle, getDefaultRegion, listHoneyVarieties, getShopSettings, getGiftShippingSurcharge } from "../../lib/medusa";
|
||||
import { formatEUR, formatEURKurz, formatGrundpreis } from "../../lib/format";
|
||||
import { findVariety, COLLECTION_LABELS } from "../../lib/varieties";
|
||||
import { PRIMARY_DOMAIN } from "../../lib/sections";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
@@ -63,9 +64,64 @@ const variety = findVariety(product.title);
|
||||
// Aus den Shop-Einstellungen, damit hier nichts steht, was an der Kasse
|
||||
// nicht gilt.
|
||||
const { freeShippingThreshold } = await getShopSettings();
|
||||
|
||||
// Strukturierte Daten für Suchmaschinen: Damit in der Trefferliste Preis und
|
||||
// Verfügbarkeit stehen können und nicht nur ein blauer Link. Jede Variante
|
||||
// wird als eigenes Angebot ausgewiesen, weil sich die Preise unterscheiden.
|
||||
// Die Brotkrumen darunter zeigen, wo die Seite im Shop hängt.
|
||||
const angebote = product.variants
|
||||
.filter((v) => v.calculated_price)
|
||||
.map((v) => ({
|
||||
"@type": "Offer",
|
||||
name: v.title,
|
||||
price: (v.calculated_price!.calculated_amount).toFixed(2),
|
||||
priceCurrency: "EUR",
|
||||
availability: "https://schema.org/InStock",
|
||||
url: `${PRIMARY_DOMAIN}/shop/${product.handle}`,
|
||||
itemCondition: "https://schema.org/NewCondition",
|
||||
}));
|
||||
|
||||
const produktDaten = {
|
||||
"@context": "https://schema.org",
|
||||
"@type": "Product",
|
||||
name: product.title,
|
||||
description: product.description ?? product.title,
|
||||
image: gallery.map((bild) => (bild.startsWith("http") ? bild : `${PRIMARY_DOMAIN}${bild}`)),
|
||||
brand: { "@type": "Brand", name: "PLACE4BEES" },
|
||||
...(angebote.length === 1 ? { offers: angebote[0] } : {}),
|
||||
...(angebote.length > 1
|
||||
? {
|
||||
offers: {
|
||||
"@type": "AggregateOffer",
|
||||
priceCurrency: "EUR",
|
||||
lowPrice: Math.min(...angebote.map((a) => Number(a.price))).toFixed(2),
|
||||
highPrice: Math.max(...angebote.map((a) => Number(a.price))).toFixed(2),
|
||||
offerCount: angebote.length,
|
||||
offers: angebote,
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
|
||||
const brotkrumenDaten = {
|
||||
"@context": "https://schema.org",
|
||||
"@type": "BreadcrumbList",
|
||||
itemListElement: [
|
||||
{ "@type": "ListItem", position: 1, name: "Shop", item: `${PRIMARY_DOMAIN}/shop` },
|
||||
...(categoryName ? [{ "@type": "ListItem", position: 2, name: categoryName }] : []),
|
||||
{
|
||||
"@type": "ListItem",
|
||||
position: categoryName ? 3 : 2,
|
||||
name: product.title,
|
||||
item: `${PRIMARY_DOMAIN}/shop/${product.handle}`,
|
||||
},
|
||||
],
|
||||
};
|
||||
---
|
||||
|
||||
<Layout title={product.title} description={product.description ?? product.title}>
|
||||
<script type="application/ld+json" is:inline set:html={JSON.stringify(produktDaten)} />
|
||||
<script type="application/ld+json" is:inline set:html={JSON.stringify(brotkrumenDaten)} />
|
||||
<section class="brand-section bg-brand-surface-strong pt-24 pb-[var(--section-y)] sm:pt-28">
|
||||
<div class="mx-auto max-w-[84rem] px-[var(--gutter)]">
|
||||
<nav aria-label="Brotkrumen" class="flex flex-wrap items-center gap-2 text-sm text-brand-text-muted">
|
||||
|
||||
Reference in New Issue
Block a user