diff --git a/components/PayloadRichText.tsx b/components/PayloadRichText.tsx index ce7f5d34..a8c471ef 100644 --- a/components/PayloadRichText.tsx +++ b/components/PayloadRichText.tsx @@ -123,11 +123,87 @@ const jsxConverters: JSXConverters = { return {text}; }, // Use div instead of p for paragraphs to allow nested block elements (like the lists above) - paragraph: ({ children }: any) =>
+ {children} ++ ), + link: ({ node, children }: any) => { + // Handling Payload CMS link nodes + const href = node?.fields?.url || node?.url || '#'; + const newTab = node?.fields?.newTab || node?.newTab; + return ( + + {children} + + ); + }, blocks: { // ... preserved existing blocks ... diff --git a/components/home/RecentPosts.tsx b/components/home/RecentPosts.tsx index 578ae707..0b66ef60 100644 --- a/components/home/RecentPosts.tsx +++ b/components/home/RecentPosts.tsx @@ -3,7 +3,7 @@ import Image from 'next/image'; import Link from 'next/link'; import { getAllPosts } from '@/lib/blog'; import { getTranslations } from 'next-intl/server'; -import { Section, Container, Heading, Card, Badge } from '../../components/ui'; +import { Section, Container, Heading } from '../../components/ui'; interface RecentPostsProps { locale: string; @@ -13,7 +13,7 @@ interface RecentPostsProps { export default async function RecentPosts({ locale, data }: RecentPostsProps) { const t = await getTranslations('Blog'); const posts = await getAllPosts(locale); - const recentPosts = posts.slice(0, 3); + const recentPosts = posts.slice(0, 4); if (recentPosts.length === 0) return null; @@ -21,9 +21,9 @@ export default async function RecentPosts({ locale, data }: RecentPostsProps) { const subtitle = data?.subtitle || t('latestNews'); return ( -