From 0473060773a7acb10a6f11e5e22ec13ddf5650ba Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sat, 14 Jun 2025 12:08:48 +0000 Subject: feat: add configuration and default image for blog posts - Introduced a new configuration file to centralize author information and default image settings for blog posts. - Added a default image path in the blog post configuration for improved content presentation. - Updated blog post schema to utilize the new configuration for author details, enhancing structured data representation. --- src/utils/schemas/blogPostSchema.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/utils/schemas/blogPostSchema.ts') diff --git a/src/utils/schemas/blogPostSchema.ts b/src/utils/schemas/blogPostSchema.ts index 9445448..4bf50f2 100644 --- a/src/utils/schemas/blogPostSchema.ts +++ b/src/utils/schemas/blogPostSchema.ts @@ -1,29 +1,33 @@ import type { WithContext, BlogPosting } from "schema-dts"; +import { config } from "../../config"; export type BlogPostSchemaParams = { - readonly author: string; readonly dateModified: string; readonly datePublished: string; readonly description: string; readonly isBasedOn?: string; readonly lang: string; + readonly preview?: string; readonly siteUrl: string; readonly slug: string; readonly title: string; }; -export default ({ siteUrl, slug, title, description, datePublished, dateModified, author, lang, isBasedOn }: BlogPostSchemaParams): WithContext => ({ +export default ({ siteUrl, slug, title, description, preview, datePublished, dateModified, lang, isBasedOn }: BlogPostSchemaParams): WithContext => ({ "@context": "https://schema.org", "@type": "BlogPosting", "url": new URL(`/blog/${slug}`, siteUrl).toString(), "headline": title, "description": description, + "image": new URL(preview ? preview : config.posts.defaultImage, siteUrl).toString(), "datePublished": datePublished, "dateModified": dateModified, "inLanguage": lang, "author": { "@type": "Person", - "name": author, + "name": config.author.name, + "url": config.author.url, + "sameAs": config.author.sameAs, }, "mainEntityOfPage": { "@type": "WebPage", -- cgit v1.2.3