0
mirror of https://github.com/valentineus/popov.link.git synced 2025-07-03 16:10:26 +03:00

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.
This commit is contained in:
2025-06-14 12:08:48 +00:00
parent a65e9c8455
commit 0473060773
11 changed files with 18 additions and 12 deletions

BIN
public/images/photo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 KiB

10
src/config.ts Normal file
View File

@ -0,0 +1,10 @@
export const config = {
author: {
name: "Valentin Popov",
url: "https://popov.link/",
sameAs: ["https://www.linkedin.com/in/valentineus/", "https://github.com/valentineus"],
},
posts: {
defaultImage: "/images/photo.png",
},
};

View File

@ -4,7 +4,6 @@ title: 'Create ".lib" file from ".dll" (archive)'
description: "Learn how to generate a *.lib file from a *.dll with this comprehensive guide. Using the Visual Studio Command Prompt and Microsoft's recommended tools, this article walks you through the steps for a seamless process. Perfect for developers working with 3rd party win dll's." description: "Learn how to generate a *.lib file from a *.dll with this comprehensive guide. Using the Visual Studio Command Prompt and Microsoft's recommended tools, this article walks you through the steps for a seamless process. Perfect for developers working with 3rd party win dll's."
datePublished: "2023-05-04" datePublished: "2023-05-04"
dateModified: "2023-05-04" dateModified: "2023-05-04"
author: "Valentin Popov"
lang: "en" lang: "en"
--- ---

View File

@ -3,7 +3,6 @@ title: "Горячая перезагрузка ElectronJS приложения"
description: "Руководство по автоматической перезагрузке приложений на Electron с помощью пакетов electron-reload и electron-webpack. Обход проблем с совместимостью и использование HMR для renderer процесса." description: "Руководство по автоматической перезагрузке приложений на Electron с помощью пакетов electron-reload и electron-webpack. Обход проблем с совместимостью и использование HMR для renderer процесса."
datePublished: "2019-08-15" datePublished: "2019-08-15"
dateModified: "2019-08-15" dateModified: "2019-08-15"
author: "Valentin Popov"
lang: "ru" lang: "ru"
--- ---

View File

@ -3,7 +3,6 @@ title: "Example Content"
description: "Howdy! This is an example blog post that shows several types of HTML content supported in this theme." description: "Howdy! This is an example blog post that shows several types of HTML content supported in this theme."
datePublished: "2018-01-01" datePublished: "2018-01-01"
dateModified: "2018-01-01" dateModified: "2018-01-01"
author: "Example User"
lang: "en" lang: "en"
draft: true draft: true
--- ---

View File

@ -3,7 +3,6 @@ title: 'Получение исходного кода "Chromium Projects"'
description: "Изучение исходных кодов Chromium: подготовка системы и установка необходимых программных компонентов. Руководство для начинающих разработчиков. Получите инструкции по установке Microsoft Visual Studio, Cygwin, Python и других инструментов. Действительно на январь-февраль 2012 года." description: "Изучение исходных кодов Chromium: подготовка системы и установка необходимых программных компонентов. Руководство для начинающих разработчиков. Получите инструкции по установке Microsoft Visual Studio, Cygwin, Python и других инструментов. Действительно на январь-февраль 2012 года."
datePublished: "2012-01-30" datePublished: "2012-01-30"
dateModified: "2012-01-30" dateModified: "2012-01-30"
author: "Valentin Popov"
lang: "ru" lang: "ru"
--- ---

View File

@ -3,7 +3,6 @@ title: "Установка Moodle в Fedora"
description: "Решение проблем установки Moodle из-за SELinux: как настроить правила доступа для устранения ошибок в веб-интерфейсе и при работе с cURL. Практические советы и команды." description: "Решение проблем установки Moodle из-за SELinux: как настроить правила доступа для устранения ошибок в веб-интерфейсе и при работе с cURL. Практические советы и команды."
datePublished: "2018-07-23" datePublished: "2018-07-23"
dateModified: "2018-07-23" dateModified: "2018-07-23"
author: "Valentin Popov"
lang: "ru" lang: "ru"
--- ---

View File

@ -3,7 +3,6 @@ title: "Компиляция Rust на TL-MR3020"
description: 'Как настроить и оптимизировать проект Rust для кросс-компиляции на TP-Link TL-MR3020 с использованием Fedora Linux 38 и OpenWrt 22.03.4. Шаг за шагом от базового "Hello, World!" до асинхронного TCP сервера.' description: 'Как настроить и оптимизировать проект Rust для кросс-компиляции на TP-Link TL-MR3020 с использованием Fedora Linux 38 и OpenWrt 22.03.4. Шаг за шагом от базового "Hello, World!" до асинхронного TCP сервера.'
datePublished: "2023-05-01" datePublished: "2023-05-01"
dateModified: "2023-05-01" dateModified: "2023-05-01"
author: "Valentin Popov"
lang: "ru" lang: "ru"
--- ---

View File

@ -3,13 +3,13 @@ import { defineCollection, z } from "astro:content";
const blog = defineCollection({ const blog = defineCollection({
type: "content", type: "content",
schema: z.object({ schema: z.object({
author: z.string(),
basedOn: z.optional(z.string()), basedOn: z.optional(z.string()),
dateModified: z.coerce.date(), dateModified: z.coerce.date(),
datePublished: z.coerce.date(), datePublished: z.coerce.date(),
description: z.string(), description: z.string(),
draft: z.optional(z.boolean()), draft: z.optional(z.boolean()),
lang: z.string(), lang: z.string(),
preview: z.optional(z.string()),
title: z.string(), title: z.string(),
}), }),
}); });

View File

@ -22,7 +22,6 @@ const post = Astro.props;
const { Content, remarkPluginFrontmatter } = await post.render(); const { Content, remarkPluginFrontmatter } = await post.render();
const author = post.data.author;
const description = post.data.description; const description = post.data.description;
const isBasedOn = post.data.basedOn; const isBasedOn = post.data.basedOn;
const lang = post.data.lang; const lang = post.data.lang;
@ -40,7 +39,6 @@ const schema = blogPostSchema({
slug, slug,
datePublished, datePublished,
dateModified, dateModified,
author,
lang, lang,
isBasedOn, isBasedOn,
}); });

View File

@ -1,29 +1,33 @@
import type { WithContext, BlogPosting } from "schema-dts"; import type { WithContext, BlogPosting } from "schema-dts";
import { config } from "../../config";
export type BlogPostSchemaParams = { export type BlogPostSchemaParams = {
readonly author: string;
readonly dateModified: string; readonly dateModified: string;
readonly datePublished: string; readonly datePublished: string;
readonly description: string; readonly description: string;
readonly isBasedOn?: string; readonly isBasedOn?: string;
readonly lang: string; readonly lang: string;
readonly preview?: string;
readonly siteUrl: string; readonly siteUrl: string;
readonly slug: string; readonly slug: string;
readonly title: string; readonly title: string;
}; };
export default ({ siteUrl, slug, title, description, datePublished, dateModified, author, lang, isBasedOn }: BlogPostSchemaParams): WithContext<BlogPosting> => ({ export default ({ siteUrl, slug, title, description, preview, datePublished, dateModified, lang, isBasedOn }: BlogPostSchemaParams): WithContext<BlogPosting> => ({
"@context": "https://schema.org", "@context": "https://schema.org",
"@type": "BlogPosting", "@type": "BlogPosting",
"url": new URL(`/blog/${slug}`, siteUrl).toString(), "url": new URL(`/blog/${slug}`, siteUrl).toString(),
"headline": title, "headline": title,
"description": description, "description": description,
"image": new URL(preview ? preview : config.posts.defaultImage, siteUrl).toString(),
"datePublished": datePublished, "datePublished": datePublished,
"dateModified": dateModified, "dateModified": dateModified,
"inLanguage": lang, "inLanguage": lang,
"author": { "author": {
"@type": "Person", "@type": "Person",
"name": author, "name": config.author.name,
"url": config.author.url,
"sameAs": config.author.sameAs,
}, },
"mainEntityOfPage": { "mainEntityOfPage": {
"@type": "WebPage", "@type": "WebPage",