From a81117972d39df35574bbab809bb590abc874761 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sat, 14 Jun 2025 19:25:16 +0000 Subject: feat: implement Open Graph image generation and enhance configuration - Added ogImages integration to generate Open Graph images for blog posts. - Updated configuration to include Open Graph settings and default preview image. - Refactored Head component to utilize new preview property for Open Graph meta tags. - Enhanced blog post schema to include preview image for structured data representation. - Introduced utility functions for creating Open Graph images with dynamic content. --- src/components/Head.astro | 26 ++++++++++++++++++++------ src/components/OpenGraph.astro | 26 -------------------------- 2 files changed, 20 insertions(+), 32 deletions(-) delete mode 100644 src/components/OpenGraph.astro (limited to 'src/components') diff --git a/src/components/Head.astro b/src/components/Head.astro index 0026886..3fded95 100644 --- a/src/components/Head.astro +++ b/src/components/Head.astro @@ -1,16 +1,18 @@ --- import type { WithContext, Thing } from "schema-dts"; import JsonLd from "./JsonLd.astro"; -import OpenGraph from "./OpenGraph.astro"; type Props = { readonly description: string; - readonly title: string; + readonly preview: string; readonly schema: WithContext; + readonly title: string; }; -const canonicalURL = new URL(Astro.url.pathname, Astro.site); -const { description, title, schema } = Astro.props; +const { description, preview, schema, title } = Astro.props; + +const canonicalUrl = new URL(Astro.url.pathname, Astro.site); +const previewUrl = new URL(preview, Astro.site); --- @@ -24,7 +26,7 @@ const { description, title, schema } = Astro.props; - + {title} @@ -35,6 +37,18 @@ const { description, title, schema } = Astro.props; - + + + + + + + + + + + + + diff --git a/src/components/OpenGraph.astro b/src/components/OpenGraph.astro deleted file mode 100644 index 6ca1856..0000000 --- a/src/components/OpenGraph.astro +++ /dev/null @@ -1,26 +0,0 @@ ---- -import { config } from "../config"; - -type Props = { - readonly description: string; - readonly title: string; -}; - -const canonicalURL = new URL(Astro.url.pathname, Astro.site); -const { description, title } = Astro.props; - -const image = new URL(config.posts.defaultImage, Astro.site).toString(); ---- - - - - - - - - - - - - - -- cgit v1.2.3