diff options
| author | Valentin Popov <valentin@popov.link> | 2026-04-22 19:11:58 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-04-22 19:11:58 +0300 |
| commit | 5e818d804d5d38beff0f3754a006333752fd5082 (patch) | |
| tree | 7f2d1097390bbdb3c5fa1593f6d15d6dfb3b0dd8 /src/pages/blog/index.astro | |
| parent | 41bb3099660b6210a419c4190a1bc08d7ba58c00 (diff) | |
| download | popov.link-5e818d804d5d38beff0f3754a006333752fd5082.tar.xz popov.link-5e818d804d5d38beff0f3754a006333752fd5082.zip | |
refactor: update schema handling and improve SEO metadata
- Changed schema type from WithContext<Thing> 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.
Diffstat (limited to 'src/pages/blog/index.astro')
| -rw-r--r-- | src/pages/blog/index.astro | 20 |
1 files changed, 15 insertions, 5 deletions
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/" }, + ], + }), +]; --- <Layout title={title} description={description} preview={preview} lang={lang} schema={schema}> |
