mirror of
https://github.com/valentineus/popov.link.git
synced 2025-07-03 16:10:26 +03:00
- Replaced `pubDate` with `datePublished` in blog post components for consistency. - Updated sorting logic in blog sections to use `datePublished`. - Enhanced blog post schema to include `dateModified` for better structured data representation. - Adjusted various blog markdown files to reflect the new date fields.
25 lines
718 B
TypeScript
25 lines
718 B
TypeScript
import type { WithContext, CollectionPage } from "schema-dts";
|
|
import type { CollectionEntry } from "astro:content";
|
|
|
|
export type BlogSchemaParams = {
|
|
readonly posts: CollectionEntry<"blog">[];
|
|
readonly siteUrl: string;
|
|
readonly title: string;
|
|
};
|
|
|
|
export default ({ siteUrl, title, posts }: BlogSchemaParams): WithContext<CollectionPage> => ({
|
|
"@context": "https://schema.org",
|
|
"@type": "CollectionPage",
|
|
"url": new URL("/blog/", siteUrl).toString(),
|
|
"name": title,
|
|
"mainEntity": {
|
|
"@type": "ItemList",
|
|
"itemListElement": posts.map((post, index) => ({
|
|
"@type": "ListItem",
|
|
"position": index + 1,
|
|
"url": new URL(`/blog/${post.slug}`, siteUrl).toString(),
|
|
"name": post.data.title,
|
|
})),
|
|
},
|
|
});
|