mirror of
https://github.com/valentineus/popov.link.git
synced 2025-10-23 09:34:05 +03:00
refactor: update blog post date handling and schema
- 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.
This commit is contained in:
@@ -1,23 +1,24 @@
|
||||
import type { WithContext, BlogPosting } from "schema-dts";
|
||||
|
||||
export type BlogPostSchemaParams = {
|
||||
readonly siteUrl: string;
|
||||
readonly title: string;
|
||||
readonly description: string;
|
||||
readonly slug: string;
|
||||
readonly datePublished: string;
|
||||
readonly author: string;
|
||||
readonly dateModified: string;
|
||||
readonly datePublished: string;
|
||||
readonly description: string;
|
||||
readonly lang: string;
|
||||
readonly siteUrl: string;
|
||||
readonly slug: string;
|
||||
readonly title: string;
|
||||
};
|
||||
|
||||
export default ({ siteUrl, title, description, slug, datePublished, author, lang }: BlogPostSchemaParams): WithContext<BlogPosting> => ({
|
||||
export default ({ siteUrl, slug, title, description, datePublished, dateModified, author, lang }: BlogPostSchemaParams): WithContext<BlogPosting> => ({
|
||||
"@context": "https://schema.org",
|
||||
"@type": "BlogPosting",
|
||||
"url": new URL(`/blog/${slug}`, siteUrl).toString(),
|
||||
"headline": title,
|
||||
"description": description,
|
||||
"datePublished": datePublished,
|
||||
"dateModified": datePublished,
|
||||
"dateModified": dateModified,
|
||||
"inLanguage": lang,
|
||||
"author": {
|
||||
"@type": "Person",
|
||||
|
@@ -2,9 +2,9 @@ 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;
|
||||
readonly posts: CollectionEntry<"blog">[];
|
||||
};
|
||||
|
||||
export default ({ siteUrl, title, posts }: BlogSchemaParams): WithContext<CollectionPage> => ({
|
||||
|
@@ -1,13 +1,15 @@
|
||||
import type { WithContext, WebSite } from "schema-dts";
|
||||
|
||||
export type WebsiteSchemaParams = {
|
||||
readonly description: string;
|
||||
readonly siteUrl: string;
|
||||
readonly title: string;
|
||||
};
|
||||
|
||||
export default ({ siteUrl, title }: WebsiteSchemaParams): WithContext<WebSite> => ({
|
||||
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