feat: payload cms

This commit is contained in:
2026-02-24 15:52:16 +01:00
parent a5d77fc69b
commit 4742630260
21 changed files with 255 additions and 22850 deletions

View File

@@ -32,6 +32,8 @@ export interface PostFrontmatter {
date: string;
excerpt?: string;
featuredImage?: string | null;
focalX?: number;
focalY?: number;
category?: string;
locale: string;
public?: boolean;
@@ -83,6 +85,14 @@ export async function getPostBySlug(slug: string, locale: string): Promise<PostM
typeof doc.featuredImage === 'object' && doc.featuredImage !== null
? doc.featuredImage.sizes?.card?.url || doc.featuredImage.url
: null,
focalX:
typeof doc.featuredImage === 'object' && doc.featuredImage !== null
? doc.featuredImage.focalX
: 50,
focalY:
typeof doc.featuredImage === 'object' && doc.featuredImage !== null
? doc.featuredImage.focalY
: 50,
public: doc._status === 'published',
} as PostFrontmatter,
content: doc.content as any, // Native Lexical Editor State
@@ -117,6 +127,14 @@ export async function getAllPosts(locale: string): Promise<PostMdx[]> {
typeof doc.featuredImage === 'object' && doc.featuredImage !== null
? doc.featuredImage.sizes?.card?.url || doc.featuredImage.url
: null,
focalX:
typeof doc.featuredImage === 'object' && doc.featuredImage !== null
? doc.featuredImage.focalX
: 50,
focalY:
typeof doc.featuredImage === 'object' && doc.featuredImage !== null
? doc.featuredImage.focalY
: 50,
} as PostFrontmatter,
// Pass the Lexical content object rather than raw markdown string
content: doc.content as any,