Skip to content

Commit e04e186

Browse files
fix(frontend): ensure blog author data populates (#654)
1 parent 5b337c9 commit e04e186

File tree

4 files changed

+38
-12
lines changed

4 files changed

+38
-12
lines changed

src/app/(frontend)/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export default async function Home() {
4343
excerpt: true,
4444
content: true,
4545
categories: true,
46+
authors: true,
4647
populatedAuthors: true,
4748
publishedAt: true,
4849
heroImage: true,

src/app/(frontend)/partners/clinics/page.tsx

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
} from '@/components/organisms/Landing'
1414
import { BlogCardCollection } from '@/components/organisms/Blog/BlogCardCollection'
1515
import {
16-
clinicBlogData,
1716
clinicCategoriesData,
1817
clinicCategoryFeaturedIds,
1918
clinicCategoryItems,
@@ -34,6 +33,9 @@ import {
3433
landingProcessPlaceholderSubtitle,
3534
landingProcessPlaceholderTitle,
3635
} from '@/utilities/placeholders/landingProcess'
36+
import { normalizePost } from '@/utilities/blog/normalizePost'
37+
import { getPayload } from 'payload'
38+
import configPromise from '@payload-config'
3739

3840
// TODO: Temporary fixtures for layout; replace with Payload data.
3941

@@ -43,7 +45,31 @@ export const metadata: Metadata = {
4345
'Increase your clinic’s international reach and connect with qualified patients worldwide. Our comparison platform helps clinics, medical networks, and international patient departments gain visibility, trust, and high-intent inquiries - globally and sustainably.',
4446
}
4547

46-
export default function ClinicLandingPage() {
48+
export const revalidate = 600
49+
50+
export default async function ClinicLandingPage() {
51+
// Fetch latest 3 blog posts for clinic landing page
52+
const payload = await getPayload({ config: configPromise })
53+
const posts = await payload.find({
54+
collection: 'posts',
55+
depth: 1,
56+
limit: 3,
57+
overrideAccess: false,
58+
select: {
59+
title: true,
60+
slug: true,
61+
excerpt: true,
62+
categories: true,
63+
authors: true,
64+
populatedAuthors: true,
65+
publishedAt: true,
66+
heroImage: true,
67+
},
68+
sort: '-publishedAt',
69+
})
70+
71+
const normalizedPosts = posts.docs.map(normalizePost)
72+
4773
return (
4874
<main className="flex min-h-screen flex-col">
4975
<LandingHero title={clinicHeroData.title} description={clinicHeroData.description} image={clinicHeroData.image} />
@@ -105,16 +131,13 @@ export default function ClinicLandingPage() {
105131
items={clinicPartnersFaqSection.items}
106132
defaultOpenItemId={clinicPartnersFaqSection.defaultOpenItemId}
107133
/>
108-
<BlogCardCollection
109-
posts={clinicBlogData.map((p) => ({
110-
title: p.title,
111-
href: `/posts/${p.title.toLowerCase().replace(/\s+/g, '-')}`,
112-
excerpt: p.excerpt,
113-
dateLabel: p.date,
114-
readTime: '5 Min. Lesezeit',
115-
image: p.image ? { src: p.image, alt: p.title } : undefined,
116-
}))}
117-
/>
134+
{normalizedPosts.length > 0 && (
135+
<BlogCardCollection
136+
title="From our blog"
137+
intro="Explore practical insights, expert perspectives, and the latest topics across health and medicine."
138+
posts={normalizedPosts}
139+
/>
140+
)}
118141
<LandingContact
119142
title="Kontakt"
120143
description="Interested in gaining international patients and increasing your clinic’s global reach? Contact us to explore how your clinic can benefit from our international comparison platform."

src/app/(frontend)/posts/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default async function Page() {
2828
excerpt: true,
2929
content: true,
3030
categories: true,
31+
authors: true,
3132
populatedAuthors: true,
3233
publishedAt: true,
3334
heroImage: true,

src/app/(frontend)/posts/page/[pageNumber]/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export default async function Page({ params: paramsPromise }: Args) {
3939
excerpt: true,
4040
content: true,
4141
categories: true,
42+
authors: true,
4243
populatedAuthors: true,
4344
publishedAt: true,
4445
heroImage: true,

0 commit comments

Comments
 (0)