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:
@@ -26,9 +26,12 @@ 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];
|
||||
const jsonLd = JSON.stringify({
|
||||
"@context": "https://schema.org",
|
||||
"@graph": structuredData ? [websiteJsonLd, structuredData] : [websiteJsonLd],
|
||||
"@graph": jsonLdGraph,
|
||||
}).replaceAll("<", "\\u003c");
|
||||
---
|
||||
<!doctype html>
|
||||
|
||||
Reference in New Issue
Block a user