Skip to content

Show updated date on blog post cards#8013

Open
vanrensbird wants to merge 1 commit into
mainfrom
blog/show-updated-date-on-cards
Open

Show updated date on blog post cards#8013
vanrensbird wants to merge 1 commit into
mainfrom
blog/show-updated-date-on-cards

Conversation

@vanrensbird

@vanrensbird vanrensbird commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What

Renders an Updated {date} label on blog post cards alongside the original publish date, separated by a | when both are present.

Threads an optional updatedAt field (already defined in source.config.ts as z.coerce.date().optional()) from post frontmatter through the card builders to the shared PostCard UI component:

  • packages/ui/src/components/post-card.tsx — adds updatedAt to the type and renders the label + | separator (aria-hidden, only shown when both dates exist)
  • apps/blog/src/components/PostCard.tsx — passes a formatted updatedAt through
  • apps/blog/src/components/BlogGrid.tsx — adds updatedAt to BlogCardItem
  • apps/blog/src/lib/post-card-item.ts, apps/blog/src/app/(blog)/page.tsx, apps/blog/src/app/(blog)/series/[key]/page.tsx — each compute updatedAtISO from frontmatter with NaN guards

Why

Surfaces refresh dates on the series and home listings, supporting the blog-refresh program's ability to tie content updates to visitor changes.

Testing

  • tsc --noEmit passes clean
  • Verified in dev server: the 4 refreshed backend-TS series posts render <original date> | Updated July 3, 2026; posts without updatedAt show no label

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Posts can now display an “Updated” date when a valid last-updated timestamp is available.
    • Blog cards and post cards now carry updated-date information throughout the app.
  • Bug Fixes
    • Invalid or missing updated-date values are now handled safely and won’t break post displays.
    • When both publish and update dates exist, they are shown together with clear separation.

Thread an optional updatedAt field from post frontmatter through the card
builders to the PostCard UI, rendering "Updated {date}" alongside the
original publish date (separated by a "|" when both are present). Surfaces
refresh dates on the series and home listings.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview, Comment Jul 6, 2026 11:28am
docs Ready Ready Preview, Comment Jul 6, 2026 11:28am
eclipse Ready Ready Preview, Comment Jul 6, 2026 11:28am
site Ready Ready Preview, Comment Jul 6, 2026 11:28am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Adds an optional updatedAt field to blog post data flows. Parses and validates updatedAt timestamps in the blog home, series, and post-card-item builders, extends BlogCardItem/PostCardItem types across blog and UI packages, and renders an "Updated" label with separator in the shared PostCard component.

Changes

updatedAt Propagation

Layer / File(s) Summary
Type contracts
apps/blog/src/components/BlogGrid.tsx, apps/blog/src/components/PostCard.tsx, packages/ui/src/components/post-card.tsx
Adds optional updatedAt?: string | null to BlogCardItem and PostCardItem type declarations.
Parsing and mapping updatedAt
apps/blog/src/app/(blog)/page.tsx, apps/blog/src/app/(blog)/series/[key]/page.tsx, apps/blog/src/lib/post-card-item.ts, apps/blog/src/components/PostCard.tsx
Validates and converts data.updatedAt/post.updatedAt into an ISO string (falling back to null) and includes it in returned card items.
Rendering updatedAt
packages/ui/src/components/post-card.tsx
Renders "Updated {updatedAt}" with a conditional separator when both date and updatedAt are present.

Estimated code review effort: 2 (Simple) | ~12 minutes

Possibly related PRs

  • prisma/web#7970: Both PRs implement the same updatedAt blog-post field—this PR propagates it through card types and rendering while the related PR extends the schema and uses it on the slug page's "Updated…"/dateModified output.

Poem

A field named updatedAt hops in,
Through pages, cards, and props within,
Validated dates, ISO-bound,
A tiny pipe separator found,
"Updated" now the readers grin. 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: surfacing updated dates on blog post cards.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@argos-ci

argos-ci Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Jul 6, 2026, 11:35 AM

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
apps/blog/src/app/(blog)/page.tsx (1)

93-99: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Minor inconsistency: unlike dateISO above, this block skips the try/catch.

The dateISO computation just above wraps new Date(data.date) in try/catch; this new updatedAtISO block doesn't, despite parsing similarly untrusted frontmatter data. Low risk since new Date() rarely throws for string/Date inputs, but worth aligning for consistency.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/blog/src/app/`(blog)/page.tsx around lines 93 - 99, The updatedAtISO
parsing block in page.tsx is inconsistent with the dateISO logic because it does
not use the same try/catch pattern around untrusted frontmatter parsing. Update
the updatedAtISO computation in the same render/data-prep flow as dateISO to
mirror that error-handling style, using the existing data.updatedAt handling and
keeping the fallback to null if parsing fails.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/blog/src/app/`(blog)/page.tsx:
- Around line 93-99: The updatedAtISO parsing block in page.tsx is inconsistent
with the dateISO logic because it does not use the same try/catch pattern around
untrusted frontmatter parsing. Update the updatedAtISO computation in the same
render/data-prep flow as dateISO to mirror that error-handling style, using the
existing data.updatedAt handling and keeping the fallback to null if parsing
fails.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e89e48e7-646d-465f-9f0e-18efc53c7127

📥 Commits

Reviewing files that changed from the base of the PR and between 4ce472a and e15884a.

📒 Files selected for processing (6)
  • apps/blog/src/app/(blog)/page.tsx
  • apps/blog/src/app/(blog)/series/[key]/page.tsx
  • apps/blog/src/components/BlogGrid.tsx
  • apps/blog/src/components/PostCard.tsx
  • apps/blog/src/lib/post-card-item.ts
  • packages/ui/src/components/post-card.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant