0
mirror of https://github.com/valentineus/popov.link.git synced 2025-07-04 00:20: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

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."
datePublished: "2023-05-04"
dateModified: "2023-05-04"
author: "Valentin Popov"
lang: "en"
---

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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<BlogPosting> => ({
export default ({ siteUrl, slug, title, description, preview, datePublished, dateModified, lang, isBasedOn }: BlogPostSchemaParams): WithContext<BlogPosting> => ({
"@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",