From a8a895269809a82434cbcd2084d6df3ccbadb5d9 Mon Sep 17 00:00:00 2001 From: Benjamin Dehli Date: Tue, 28 May 2024 21:40:29 +0200 Subject: [PATCH] Add rich snippets for ApplicationSoftware --- src/components/partials/Product.js | 35 +++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/components/partials/Product.js b/src/components/partials/Product.js index 1e8e7d54..5f10e70a 100644 --- a/src/components/partials/Product.js +++ b/src/components/partials/Product.js @@ -31,6 +31,32 @@ const Product = ({ product, fullscreen }) => { const productDate = new Date(product.timestamp).toISOString(); const plusOneYear = new Date(new Date().setFullYear(new Date().getFullYear() + 1)).toISOString(); + const applicationJsonLd = { + "@context": "http://schema.org", + "@type": "SoftwareApplication", + "@id": `https://www.dehlimusikk.no/${languageSlug}products/${productId}/`, + "url": `https://www.dehlimusikk.no/${languageSlug}products/${productId}/`, + "name": product.title, + "operatingSystem": "All", + "applicationCategory": ["EntertainmentApplication", "MultimediaApplication"], + "softwareRequirements": "DecentSampler", + "offers": { + "@type": "Offer", + "price": product.price?.length ? product.price : 0, + "priceCurrency": product.priceCurrency?.length ? product.priceCurrency : 'USD', + "url": product.link.url, + "availability": "http://schema.org/OnlineOnly", + "validFrom": productDate, + "priceValidUntil": plusOneYear, + "doesNotShip": true, + "offers": [ + { + "@type": "Offer", + "url": product.link.url + }, + ] + }, + } const snippet = { "@context": "http://schema.org", "@type": "Product", @@ -79,7 +105,13 @@ const Product = ({ product, fullscreen }) => { "availability": "http://schema.org/OnlineOnly", "validFrom": productDate, "priceValidUntil": plusOneYear, - "doesNotShip": true + "doesNotShip": true, + "offers": [ + { + "@type": "Offer", + "url": product.link.url + }, + ] }, "mainEntityOfPage": { "@type": "WebPage", @@ -88,6 +120,7 @@ const Product = ({ product, fullscreen }) => { } return ( + ) }