From ad3fe8b06db39db67b0fb3c7c56f506db132cf81 Mon Sep 17 00:00:00 2001 From: Nurul Sundarani Date: Tue, 16 Jun 2026 19:18:12 +0530 Subject: [PATCH 1/2] (feat) Keep reading section + updated series component --- apps/blog/src/app/(blog)/[slug]/page.tsx | 7 ++- apps/blog/src/components/KeepReading.tsx | 17 +++++++ apps/blog/src/components/PostCard.tsx | 22 ++++----- apps/blog/src/components/SeriesNavigation.tsx | 32 +++++-------- apps/blog/src/lib/post-card-item.ts | 46 +++++++++++++++++++ apps/blog/src/lib/related-posts.ts | 37 +++++++++++++++ apps/blog/src/lib/series.ts | 10 ++-- packages/ui/src/components/post-card.tsx | 36 ++++----------- 8 files changed, 140 insertions(+), 67 deletions(-) create mode 100644 apps/blog/src/components/KeepReading.tsx create mode 100644 apps/blog/src/lib/post-card-item.ts create mode 100644 apps/blog/src/lib/related-posts.ts diff --git a/apps/blog/src/app/(blog)/[slug]/page.tsx b/apps/blog/src/app/(blog)/[slug]/page.tsx index 8b66172527..9f14a6986f 100644 --- a/apps/blog/src/app/(blog)/[slug]/page.tsx +++ b/apps/blog/src/app/(blog)/[slug]/page.tsx @@ -14,7 +14,9 @@ import { AuthorAvatarGroup } from "@/components/AuthorAvatarGroup"; import { SeriesBanner } from "@/components/SeriesBanner"; import { SeriesMarker } from "@/components/SeriesMarker"; import { SeriesNavigation } from "@/components/SeriesNavigation"; +import { KeepReading } from "@/components/KeepReading"; import { getSeriesContext } from "@/lib/series"; +import { getRelatedPosts } from "@/lib/related-posts"; import { getBaseUrl, withBlogBasePath, withBlogBasePathForImageSrc } from "@/lib/url"; import Link from "next/link"; import type { Metadata } from "next"; @@ -163,6 +165,7 @@ export default async function Page(props: { params: Promise<{ slug: string }> }) const MDX = page.data.body; const blogPostingJsonLd = getBlogPostingJsonLd(page); const seriesContext = getSeriesContext(page); + const relatedPosts = seriesContext ? [] : getRelatedPosts(page, 2); const newsletterApiUrl = withBlogBasePath("/api/newsletter"); return ( @@ -257,7 +260,9 @@ export default async function Page(props: { params: Promise<{ slug: string }> }) - ) : null} + ) : ( + + )} {/* Conversion CTA */} diff --git a/apps/blog/src/components/KeepReading.tsx b/apps/blog/src/components/KeepReading.tsx new file mode 100644 index 0000000000..4b9eefbd44 --- /dev/null +++ b/apps/blog/src/components/KeepReading.tsx @@ -0,0 +1,17 @@ +import { PostCard } from "./PostCard"; +import type { BlogCardItem } from "./BlogGrid"; + +export function KeepReading({ posts }: { posts: BlogCardItem[] }) { + if (posts.length === 0) return null; + + return ( +
+

Keep reading

+
+ {posts.map((post) => ( + + ))} +
+
+ ); +} diff --git a/apps/blog/src/components/PostCard.tsx b/apps/blog/src/components/PostCard.tsx index 0789d79631..14df8e0048 100644 --- a/apps/blog/src/components/PostCard.tsx +++ b/apps/blog/src/components/PostCard.tsx @@ -26,25 +26,19 @@ export function PostCard({ post, currentCategory, featured = false, + vertical = false, }: { post: PostCardItem; currentCategory: string; featured?: boolean; + vertical?: boolean; }) { const sourceAuthorNames = - post.authors && post.authors.length > 0 - ? post.authors - : post.author - ? [post.author] - : []; - const authorProfiles: AuthorProfile[] = getAuthorProfiles(sourceAuthorNames).map( - (profile) => ({ - name: profile.name, - imageSrc: profile.imageSrc - ? withBlogBasePathForImageSrc(profile.imageSrc) - : null, - }), - ); + post.authors && post.authors.length > 0 ? post.authors : post.author ? [post.author] : []; + const authorProfiles: AuthorProfile[] = getAuthorProfiles(sourceAuthorNames).map((profile) => ({ + name: profile.name, + imageSrc: profile.imageSrc ? withBlogBasePathForImageSrc(profile.imageSrc) : null, + })); const author: AuthorProfile | null = authorProfiles[0] ?? null; const badge = @@ -64,5 +58,5 @@ export function PostCard({ badge, }; - return ; + return ; } diff --git a/apps/blog/src/components/SeriesNavigation.tsx b/apps/blog/src/components/SeriesNavigation.tsx index 36bf1de2b7..fff16b73c7 100644 --- a/apps/blog/src/components/SeriesNavigation.tsx +++ b/apps/blog/src/components/SeriesNavigation.tsx @@ -1,38 +1,28 @@ -import Link from "next/link"; +import { PostCard } from "./PostCard"; import type { SeriesContext } from "@/lib/series"; export function SeriesNavigation({ series }: { series: SeriesContext }) { if (!series.prev && !series.next) return null; return ( -