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/pages/blog/index.astro | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/pages/blog/index.astro') diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index 3a27111..aa1b46c 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -3,9 +3,11 @@ import type { CollectionEntry } from "astro:content"; import { config } from "../../config"; import { getCollection } from "astro:content"; import blogSchema from "../../utils/schemas/blogSchema"; +import breadcrumbSchema from "../../utils/schemas/breadcrumbSchema"; import Layout from "../../layouts/BaseLayout.astro"; import PostElement from "../../components/PostElement.astro"; import RSSIcon from "../../components/Icons/RSS.astro"; +import websiteSchema from "../../utils/schemas/websiteSchema"; const posts = await getCollection("blog", ({ data }) => { return data.draft !== true; @@ -29,11 +31,19 @@ const description = "Explore Valentin Popov's blog on software development, tech const preview = config.og.defaultPreview; const lang = "en"; -const schema = blogSchema({ - siteUrl: new URL("/", Astro.site).toString(), - title, - posts, -}); +const siteUrl = new URL("/", Astro.site).toString(); + +const schema = [ + websiteSchema({ siteUrl, name: config.og.website, description, lang }), + blogSchema({ siteUrl, title, description, lang, posts }), + breadcrumbSchema({ + siteUrl, + items: [ + { name: "Home", url: "/" }, + { name: "Blog", url: "/blog/" }, + ], + }), +]; --- -- cgit v1.2.3