A08: Skip misleading structuredData on error pages

- Dataset/CollectionPage not rendered on noindex error pages (422/503/404)
- WebSite schema always present for navigation
- noindex + nofollow on error/admin pages
- canonical URL consistent with trailingSlash: never policy
- Astro check: 0 errors
This commit is contained in:
ik
2026-09-10 06:12:32 +07:00
parent 9e4d7aefba
commit 745a5ff9fd
+4 -1
View File
@@ -26,9 +26,12 @@ const canonical = new URL(path, siteUrl).toString();
const socialImage = new URL(image, siteUrl).toString(); const socialImage = new URL(image, siteUrl).toString();
const preventIndexing = noindex || path.startsWith("/admin/"); const preventIndexing = noindex || path.startsWith("/admin/");
const websiteJsonLd = { "@type": "WebSite", name: "RF4 Spotter", url: siteUrl, inLanguage: "ru" }; 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];
const jsonLd = JSON.stringify({ const jsonLd = JSON.stringify({
"@context": "https://schema.org", "@context": "https://schema.org",
"@graph": structuredData ? [websiteJsonLd, structuredData] : [websiteJsonLd], "@graph": jsonLdGraph,
}).replaceAll("<", "\\u003c"); }).replaceAll("<", "\\u003c");
--- ---
<!doctype html> <!doctype html>