mirror of
				https://github.com/valentineus/popov.link.git
				synced 2025-11-04 14:59:45 +03:00 
			
		
		
		
	feat: enhance blog post and page schema with new properties
- Added optional `basedOn` field to blog post schema for better content attribution. - Updated blog post markdown to include `basedOn` reference for improved context. - Refactored page schema to replace deprecated website schema, enhancing structured data representation. - Adjusted 404 and index pages to utilize the new page schema for consistency and SEO improvements.
This commit is contained in:
		@@ -1,9 +1,10 @@
 | 
				
			|||||||
---
 | 
					---
 | 
				
			||||||
 | 
					basedOn: "https://adrianhenke.wordpress.com/2008/12/05/create-lib-file-from-dll/"
 | 
				
			||||||
title: 'Create ".lib" file from ".dll" (archive)'
 | 
					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: "Adrian Henke"
 | 
					author: "Valentin Popov"
 | 
				
			||||||
lang: "en"
 | 
					lang: "en"
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,7 @@ const blog = defineCollection({
 | 
				
			|||||||
	type: "content",
 | 
						type: "content",
 | 
				
			||||||
	schema: z.object({
 | 
						schema: z.object({
 | 
				
			||||||
		author: z.string(),
 | 
							author: 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(),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,15 +1,17 @@
 | 
				
			|||||||
---
 | 
					---
 | 
				
			||||||
import Layout from "../layouts/BaseLayout.astro";
 | 
					import Layout from "../layouts/BaseLayout.astro";
 | 
				
			||||||
import websiteSchema from "../utils/schemas/websiteSchema";
 | 
					import pageSchema from "../utils/schemas/pageSchema";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const title = "404 — Page Not Found | Valentin Popov";
 | 
					const title = "404 — Page Not Found | Valentin Popov";
 | 
				
			||||||
const description = "The page you're looking for doesn't exist!";
 | 
					const description = "The page you're looking for doesn't exist!";
 | 
				
			||||||
const lang = "en";
 | 
					const lang = "en";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const schema = websiteSchema({
 | 
					const schema = pageSchema({
 | 
				
			||||||
	siteUrl: new URL("/", Astro.site).toString(),
 | 
						siteUrl: new URL("/", Astro.site).toString(),
 | 
				
			||||||
 | 
						page: "/404",
 | 
				
			||||||
	title,
 | 
						title,
 | 
				
			||||||
	description,
 | 
						description,
 | 
				
			||||||
 | 
						lang,
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,15 +22,16 @@ const post = Astro.props;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const { Content, remarkPluginFrontmatter } = await post.render();
 | 
					const { Content, remarkPluginFrontmatter } = await post.render();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const title = post.data.title;
 | 
					 | 
				
			||||||
const description = post.data.description;
 | 
					 | 
				
			||||||
const author = post.data.author;
 | 
					const author = post.data.author;
 | 
				
			||||||
 | 
					const description = post.data.description;
 | 
				
			||||||
 | 
					const isBasedOn = post.data.basedOn;
 | 
				
			||||||
const lang = post.data.lang;
 | 
					const lang = post.data.lang;
 | 
				
			||||||
 | 
					 | 
				
			||||||
const formattedDate = dayjs(post.data.datePublished.toString()).format("MMMM DD, YYYY");
 | 
					 | 
				
			||||||
const datePublished = post.data.datePublished.toISOString();
 | 
					 | 
				
			||||||
const dateModified = post.data.dateModified?.toISOString();
 | 
					 | 
				
			||||||
const slug = post.slug;
 | 
					const slug = post.slug;
 | 
				
			||||||
 | 
					const title = post.data.title;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const dateModified = post.data.dateModified?.toISOString();
 | 
				
			||||||
 | 
					const datePublished = post.data.datePublished.toISOString();
 | 
				
			||||||
 | 
					const formattedDate = dayjs(post.data.datePublished.toString()).format("MMMM DD, YYYY");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const schema = blogPostSchema({
 | 
					const schema = blogPostSchema({
 | 
				
			||||||
	siteUrl: new URL("/", Astro.site).toString(),
 | 
						siteUrl: new URL("/", Astro.site).toString(),
 | 
				
			||||||
@@ -41,6 +42,7 @@ const schema = blogPostSchema({
 | 
				
			|||||||
	dateModified,
 | 
						dateModified,
 | 
				
			||||||
	author,
 | 
						author,
 | 
				
			||||||
	lang,
 | 
						lang,
 | 
				
			||||||
 | 
						isBasedOn,
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -61,7 +63,6 @@ const schema = blogPostSchema({
 | 
				
			|||||||
				<small>
 | 
									<small>
 | 
				
			||||||
					Posted
 | 
										Posted
 | 
				
			||||||
					<time datetime={datePublished} lang="en">{formattedDate}</time>
 | 
										<time datetime={datePublished} lang="en">{formattedDate}</time>
 | 
				
			||||||
					by {author}
 | 
					 | 
				
			||||||
					<span> • </span>
 | 
										<span> • </span>
 | 
				
			||||||
					<span>{remarkPluginFrontmatter.minutesRead}</span>
 | 
										<span>{remarkPluginFrontmatter.minutesRead}</span>
 | 
				
			||||||
				</small>
 | 
									</small>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,16 +3,18 @@ import Layout from "../layouts/BaseLayout.astro";
 | 
				
			|||||||
import LatestPostsSection from "../components/Sections/LatestPosts.astro";
 | 
					import LatestPostsSection from "../components/Sections/LatestPosts.astro";
 | 
				
			||||||
import SocialLinksSection from "../components/Sections/SocialLinks.astro";
 | 
					import SocialLinksSection from "../components/Sections/SocialLinks.astro";
 | 
				
			||||||
import WelcomeSection from "../components/Sections/Welcome.astro";
 | 
					import WelcomeSection from "../components/Sections/Welcome.astro";
 | 
				
			||||||
import websiteSchema from "../utils/schemas/websiteSchema";
 | 
					import pageSchema from "../utils/schemas/pageSchema";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const title = "Valentin Popov – Software Developer & Team Lead | Tech Insights";
 | 
					const title = "Valentin Popov – Software Developer & Team Lead | Tech Insights";
 | 
				
			||||||
const description = "Blog by Valentin Popov — software developer and team lead writing about code, side projects, digital tools, and fun experiments.";
 | 
					const description = "Blog by Valentin Popov — software developer and team lead writing about code, side projects, digital tools, and fun experiments.";
 | 
				
			||||||
const lang = "en";
 | 
					const lang = "en";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const schema = websiteSchema({
 | 
					const schema = pageSchema({
 | 
				
			||||||
	siteUrl: new URL("/", Astro.site).toString(),
 | 
						siteUrl: new URL("/", Astro.site).toString(),
 | 
				
			||||||
 | 
						page: "/",
 | 
				
			||||||
	title,
 | 
						title,
 | 
				
			||||||
	description,
 | 
						description,
 | 
				
			||||||
 | 
						lang,
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,13 +5,14 @@ export type BlogPostSchemaParams = {
 | 
				
			|||||||
	readonly dateModified: string;
 | 
						readonly dateModified: string;
 | 
				
			||||||
	readonly datePublished: string;
 | 
						readonly datePublished: string;
 | 
				
			||||||
	readonly description: string;
 | 
						readonly description: string;
 | 
				
			||||||
 | 
						readonly isBasedOn?: string;
 | 
				
			||||||
	readonly lang: string;
 | 
						readonly lang: 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 }: BlogPostSchemaParams): WithContext<BlogPosting> => ({
 | 
					export default ({ siteUrl, slug, title, description, datePublished, dateModified, author, 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(),
 | 
				
			||||||
@@ -28,4 +29,5 @@ export default ({ siteUrl, slug, title, description, datePublished, dateModified
 | 
				
			|||||||
		"@type": "WebPage",
 | 
							"@type": "WebPage",
 | 
				
			||||||
		"@id": new URL(`/blog/${slug}`, siteUrl).toString(),
 | 
							"@id": new URL(`/blog/${slug}`, siteUrl).toString(),
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
 | 
						...(isBasedOn && { isBasedOn: isBasedOn }),
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,6 +14,8 @@ export default ({ siteUrl, title, posts }: BlogSchemaParams): WithContext<Collec
 | 
				
			|||||||
	"name": title,
 | 
						"name": title,
 | 
				
			||||||
	"mainEntity": {
 | 
						"mainEntity": {
 | 
				
			||||||
		"@type": "ItemList",
 | 
							"@type": "ItemList",
 | 
				
			||||||
 | 
							"itemListOrder": "https://schema.org/ItemListOrderDescending",
 | 
				
			||||||
 | 
							"numberOfItems": posts.length,
 | 
				
			||||||
		"itemListElement": posts.map((post, index) => ({
 | 
							"itemListElement": posts.map((post, index) => ({
 | 
				
			||||||
			"@type": "ListItem",
 | 
								"@type": "ListItem",
 | 
				
			||||||
			"position": index + 1,
 | 
								"position": index + 1,
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										23
									
								
								src/utils/schemas/pageSchema.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								src/utils/schemas/pageSchema.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					import type { WithContext, WebPage } from "schema-dts";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export type WebsiteSchemaParams = {
 | 
				
			||||||
 | 
						readonly description: string;
 | 
				
			||||||
 | 
						readonly page: string;
 | 
				
			||||||
 | 
						readonly siteUrl: string;
 | 
				
			||||||
 | 
						readonly title: string;
 | 
				
			||||||
 | 
						readonly lang: string;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default ({ siteUrl, page, title, description, lang }: WebsiteSchemaParams): WithContext<WebPage> => ({
 | 
				
			||||||
 | 
						"@context": "https://schema.org",
 | 
				
			||||||
 | 
						"@type": "WebPage",
 | 
				
			||||||
 | 
						"@id": new URL(page, siteUrl).toString(),
 | 
				
			||||||
 | 
						"url": new URL(page, siteUrl).toString(),
 | 
				
			||||||
 | 
						"name": title,
 | 
				
			||||||
 | 
						"description": description,
 | 
				
			||||||
 | 
						"inLanguage": lang,
 | 
				
			||||||
 | 
						"mainEntity": {
 | 
				
			||||||
 | 
							"@type": "WebSite",
 | 
				
			||||||
 | 
							"@id": new URL("/", siteUrl).toString(),
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
@@ -1,15 +0,0 @@
 | 
				
			|||||||
import type { WithContext, WebSite } from "schema-dts";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export type WebsiteSchemaParams = {
 | 
					 | 
				
			||||||
	readonly description: string;
 | 
					 | 
				
			||||||
	readonly siteUrl: string;
 | 
					 | 
				
			||||||
	readonly title: string;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default ({ siteUrl, title, description }: WebsiteSchemaParams): WithContext<WebSite> => ({
 | 
					 | 
				
			||||||
	"@context": "https://schema.org",
 | 
					 | 
				
			||||||
	"@type": "WebSite",
 | 
					 | 
				
			||||||
	"url": new URL("/", siteUrl).toString(),
 | 
					 | 
				
			||||||
	"name": title,
 | 
					 | 
				
			||||||
	"description": description,
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user