From 8de77203aa137d89271d15c1839ebb84bcb0972c Mon Sep 17 00:00:00 2001 From: emil Date: Sun, 10 May 2026 21:19:39 +0300 Subject: [PATCH] feat: add JSON-LD structured data - BaseLayout: WebPage schema on every page + canonical URL - Homepages: WebSite schema - GeneratorLayout: SoftwareApplication + BreadcrumbList schemas - Add to BaseLayout for child-injected head content --- src/layouts/BaseLayout.astro | 16 +++++++++++ src/layouts/GeneratorLayout.astro | 44 +++++++++++++++++++++++++++++++ src/pages/index.astro | 14 ++++++++++ src/pages/ru/index.astro | 14 ++++++++++ 4 files changed, 88 insertions(+) diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index a5014cd..32e4305 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -18,6 +18,16 @@ const { title = T.defaultTitle, description = T.defaultDesc } = Astro.props; const pathWithoutLocale = Astro.url.pathname.replace(/^\/ru/, "") || "/"; const enUrl = `https://randify.pro${getRelativeLocaleUrl("en", pathWithoutLocale)}`; const ruUrl = `https://randify.pro${getRelativeLocaleUrl("ru", pathWithoutLocale)}`; +const canonicalUrl = `https://randify.pro${Astro.url.pathname}`; + +const webPageSchema = { + "@context": "https://schema.org", + "@type": "WebPage", + name: title, + description: description, + url: canonicalUrl, + inLanguage: lang, +}; --- @@ -33,12 +43,18 @@ const ruUrl = `https://randify.pro${getRelativeLocaleUrl("ru", pathWithoutLocale href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300..700&display=swap" rel="stylesheet" /> + +