From 0e592ea404475f60c653bf5f4b471808b0bf80cc Mon Sep 17 00:00:00 2001 From: IK Date: Thu, 10 Sep 2026 18:17:13 +0700 Subject: [PATCH] A08: Add explicit errorPage prop to skip structuredData on error pages Bug: Layout used 'noindex && path !== ""' to detect error pages, but the main page (/) with filterError (422) sets noindex=true, causing the Dataset/CollectionPage structuredData to be included on error pages. Fix: - Add explicit 'errorPage' prop to Layout component - Pass errorPage={filterError} from index.astro - Skip structuredData when errorPage=true, regardless of noindex - Main page with 422 error no longer includes Dataset schema - Normal pages with noindex (e.g., /admin) still work correctly Verification: - Astro build: 0 errors - Error pages (422, 503, 404) skip structuredData - Normal pages include structuredData - noindex still works for robots meta tag --- apps/web/src/layouts/Layout.astro | 7 ++++--- apps/web/src/pages/index.astro | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/web/src/layouts/Layout.astro b/apps/web/src/layouts/Layout.astro index a592912..1e81ea5 100644 --- a/apps/web/src/layouts/Layout.astro +++ b/apps/web/src/layouts/Layout.astro @@ -19,6 +19,7 @@ const { noindex = false, image = "/og-rf4spotter.png", structuredData = null, + errorPage = false, } = Astro.props; const path = Astro.url.pathname; const siteUrl = import.meta.env.PUBLIC_SITE_URL || "https://rf4spotter.ru"; @@ -26,9 +27,9 @@ const canonical = new URL(path, siteUrl).toString(); const socialImage = new URL(image, siteUrl).toString(); const preventIndexing = noindex || path.startsWith("/admin/"); const websiteJsonLd = { "@type": "WebSite", name: "RF4 Spotter", url: siteUrl, inLanguage: "ru" }; -// A08: Skip structuredData on error pages (noindex, 422, 503, 404) -const hasErrorStatus = noindex && path !== "/"; -const jsonLdGraph = (structuredData && !hasErrorStatus) ? [websiteJsonLd, structuredData] : [websiteJsonLd]; +// A08: Skip structuredData on error pages (explicit errorPage prop) +// Don't infer error from noindex alone — main page can have noindex on 422 +const jsonLdGraph = (structuredData && !errorPage) ? [websiteJsonLd, structuredData] : [websiteJsonLd]; const jsonLd = JSON.stringify({ "@context": "https://schema.org", "@graph": jsonLdGraph, diff --git a/apps/web/src/pages/index.astro b/apps/web/src/pages/index.astro index 58554b5..aa3c8c3 100644 --- a/apps/web/src/pages/index.astro +++ b/apps/web/src/pages/index.astro @@ -57,7 +57,7 @@ const datasetJsonLd = { creator: { "@type": "Organization", name: "RF4 Spotter" }, isAccessibleForFree: true, }; --- - +
RF4 Живая карта клёва

Выбирай место,
пока клюёт.

Свежие точки, рабочие приманки и честная оценка данных от игроков.

Туманное озеро на рассвете
Пульс водоёмов{items.length} {plural(items.length, ["точка показывает", "точки показывают", "точек показывают"])} активность