Skip to content

Commit 6b699e1

Browse files
committed
fix(blog): stack related posts vertically on mobile and fill all suggestion slots
- Add flex-col sm:flex-row and matching border classes to related posts nav for consistent mobile stacking with the main blog page - Remove score > 0 filter in getRelatedPosts so it falls back to recent posts when there aren't enough tag matches - Align description text color with main page cards
1 parent 5d6fd20 commit 6b699e1

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

apps/sim/app/(landing)/blog/[slug]/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,12 @@ export default async function Page({ params }: { params: Promise<{ slug: string
133133
{related.length > 0 && (
134134
<>
135135
<div className='h-px w-full bg-[var(--landing-bg-elevated)]' />
136-
<nav aria-label='Related posts' className='flex'>
136+
<nav aria-label='Related posts' className='flex flex-col sm:flex-row'>
137137
{related.map((p) => (
138138
<Link
139139
key={p.slug}
140140
href={`/blog/${p.slug}`}
141-
className='group flex flex-1 flex-col gap-4 border-[var(--landing-bg-elevated)] p-6 transition-colors hover:bg-[var(--landing-bg-elevated)] md:border-l md:first:border-l-0'
141+
className='group flex flex-1 flex-col gap-4 border-[var(--landing-bg-elevated)] border-t p-6 transition-colors first:border-t-0 hover:bg-[var(--landing-bg-elevated)] sm:border-t-0 sm:border-l sm:first:border-l-0'
142142
>
143143
<div className='relative aspect-video w-full overflow-hidden rounded-[5px]'>
144144
<Image
@@ -161,7 +161,7 @@ export default async function Page({ params }: { params: Promise<{ slug: string
161161
<h3 className='font-[430] font-season text-lg text-white leading-tight tracking-[-0.01em]'>
162162
{p.title}
163163
</h3>
164-
<p className='line-clamp-2 text-[var(--landing-text-muted)] text-sm leading-[150%]'>
164+
<p className='line-clamp-2 text-[#F6F6F0]/50 text-sm leading-[150%]'>
165165
{p.description}
166166
</p>
167167
</div>

apps/sim/lib/blog/registry.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,12 @@ export async function getRelatedPosts(slug: string, limit = 3): Promise<BlogMeta
192192
const posts = await getAllPostMeta()
193193
const current = posts.find((p) => p.slug === slug)
194194
if (!current) return []
195-
const scored = posts
196-
.filter((p) => p.slug !== slug)
195+
const others = posts.filter((p) => p.slug !== slug)
196+
const scored = others
197197
.map((p) => ({
198198
post: p,
199199
score: p.tags.filter((t) => current.tags.includes(t)).length,
200200
}))
201-
.filter((x) => x.score > 0)
202201
.sort((a, b) => b.score - a.score || byDateDesc(a.post, b.post))
203202
.slice(0, limit)
204203
.map((x) => x.post)

0 commit comments

Comments
 (0)