diff options
| author | Valentin Popov <valentin@popov.link> | 2025-06-14 15:08:48 +0300 | 
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2025-06-14 15:08:48 +0300 | 
| commit | 0473060773a7acb10a6f11e5e22ec13ddf5650ba (patch) | |
| tree | ac5f6e309fd5d1562b91c35d8e511df1ac6fd89d /src | |
| parent | a65e9c845543abcda641f51f4dd8cd77ab50b60d (diff) | |
| download | popov.link-0473060773a7acb10a6f11e5e22ec13ddf5650ba.tar.xz popov.link-0473060773a7acb10a6f11e5e22ec13ddf5650ba.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/config.ts | 10 | ||||
| -rw-r--r-- | src/content/blog/create-lib-file-from-dll.md | 1 | ||||
| -rw-r--r-- | src/content/blog/electron-reload.md | 1 | ||||
| -rw-r--r-- | src/content/blog/example-content.md | 1 | ||||
| -rw-r--r-- | src/content/blog/getting-source-code-of-chromium.md | 1 | ||||
| -rw-r--r-- | src/content/blog/installing-moodle-to-fedora.md | 1 | ||||
| -rw-r--r-- | src/content/blog/rust-and-tl-mr3020.md | 1 | ||||
| -rw-r--r-- | src/content/config.ts | 2 | ||||
| -rw-r--r-- | src/pages/blog/[...slug].astro | 2 | ||||
| -rw-r--r-- | src/utils/schemas/blogPostSchema.ts | 10 | 
10 files changed, 18 insertions, 12 deletions
| diff --git a/src/config.ts b/src/config.ts new file mode 100644 index 0000000..a1b0c15 --- /dev/null +++ b/src/config.ts @@ -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", +	}, +}; diff --git a/src/content/blog/create-lib-file-from-dll.md b/src/content/blog/create-lib-file-from-dll.md index 306c9b7..9cdae59 100644 --- a/src/content/blog/create-lib-file-from-dll.md +++ b/src/content/blog/create-lib-file-from-dll.md @@ -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"  --- diff --git a/src/content/blog/electron-reload.md b/src/content/blog/electron-reload.md index 804f673..cef7258 100644 --- a/src/content/blog/electron-reload.md +++ b/src/content/blog/electron-reload.md @@ -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"  --- diff --git a/src/content/blog/example-content.md b/src/content/blog/example-content.md index f6d61b0..28ce23a 100644 --- a/src/content/blog/example-content.md +++ b/src/content/blog/example-content.md @@ -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  --- diff --git a/src/content/blog/getting-source-code-of-chromium.md b/src/content/blog/getting-source-code-of-chromium.md index a47cbf4..ffe0d92 100644 --- a/src/content/blog/getting-source-code-of-chromium.md +++ b/src/content/blog/getting-source-code-of-chromium.md @@ -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"  --- diff --git a/src/content/blog/installing-moodle-to-fedora.md b/src/content/blog/installing-moodle-to-fedora.md index 2784641..17ef3da 100644 --- a/src/content/blog/installing-moodle-to-fedora.md +++ b/src/content/blog/installing-moodle-to-fedora.md @@ -3,7 +3,6 @@ title: "Установка Moodle в Fedora"  description: "Решение проблем установки Moodle из-за SELinux: как настроить правила доступа для устранения ошибок в веб-интерфейсе и при работе с cURL. Практические советы и команды."  datePublished: "2018-07-23"  dateModified: "2018-07-23" -author: "Valentin Popov"  lang: "ru"  --- diff --git a/src/content/blog/rust-and-tl-mr3020.md b/src/content/blog/rust-and-tl-mr3020.md index 8479609..d193761 100644 --- a/src/content/blog/rust-and-tl-mr3020.md +++ b/src/content/blog/rust-and-tl-mr3020.md @@ -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"  --- diff --git a/src/content/config.ts b/src/content/config.ts index 916e412..984181c 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -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(),  	}),  }); diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro index 39207dd..e347eda 100644 --- a/src/pages/blog/[...slug].astro +++ b/src/pages/blog/[...slug].astro @@ -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,  }); 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<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", | 
