From 5e818d804d5d38beff0f3754a006333752fd5082 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 22 Apr 2026 16:11:58 +0000 Subject: refactor: update schema handling and improve SEO metadata - Changed schema type from WithContext to Thing[] in Head, BaseLayout, and JsonLd components for better flexibility. - Added optional robots meta tag to Head component. - Updated JSON-LD generation in JsonLd component to include a structured payload. - Enhanced page and blog schemas to support breadcrumb and person schemas for improved SEO. - Introduced new utility schemas for website and person to streamline schema generation. - Refactored existing schemas to align with the new structure and ensure consistency across components. --- src/utils/schemas/breadcrumbSchema.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/utils/schemas/breadcrumbSchema.ts (limited to 'src/utils/schemas/breadcrumbSchema.ts') diff --git a/src/utils/schemas/breadcrumbSchema.ts b/src/utils/schemas/breadcrumbSchema.ts new file mode 100644 index 0000000..e1a1ea3 --- /dev/null +++ b/src/utils/schemas/breadcrumbSchema.ts @@ -0,0 +1,21 @@ +import type { BreadcrumbList } from "schema-dts"; + +export type BreadcrumbItem = { + readonly name: string; + readonly url: string; +}; + +export type BreadcrumbSchemaParams = { + readonly items: BreadcrumbItem[]; + readonly siteUrl: string; +}; + +export default ({ items, siteUrl }: BreadcrumbSchemaParams): BreadcrumbList => ({ + "@type": "BreadcrumbList", + "itemListElement": items.map((item, index) => ({ + "@type": "ListItem", + "position": index + 1, + "name": item.name, + "item": new URL(item.url, siteUrl).toString(), + })), +}); -- cgit v1.2.3