Skip to content

feat(blog): add json-ld#7649

Merged
mhartington merged 2 commits intomainfrom
json-ld
Mar 14, 2026
Merged

feat(blog): add json-ld#7649
mhartington merged 2 commits intomainfrom
json-ld

Conversation

@mhartington
Copy link
Member

@mhartington mhartington commented Mar 13, 2026

Summary by CodeRabbit

  • Improvements
    • Adds BlogPosting JSON-LD output to blog pages for richer search results, including author(s), images, publisher, and publication/modification dates.
    • Ensures canonical and image URLs are absolute and resolves relative paths against the site base.
    • Normalizes author data (single or multiple authors) and refines date handling with fallbacks.
    • Centralizes blog home title and description for consistent metadata.

@vercel
Copy link

vercel bot commented Mar 13, 2026

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

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview, Comment Mar 14, 2026 1:25am
docs Ready Ready Preview, Comment Mar 14, 2026 1:25am
eclipse Ready Ready Preview, Comment Mar 14, 2026 1:25am

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 13, 2026

Walkthrough

Adds BlogPosting JSON-LD generation and injection for blog post pages, and centralizes blog home title/description into shared constants used by the blog layout.

Changes

Cohort / File(s) Summary
Blog Post JSON-LD & page changes
apps/blog/src/app/(blog)/[slug]/page.tsx
Adds TypeScript schema types (PersonSchema, ImageObjectSchema, BlogPostingSchema), helpers (toIsoDate, getBlogPostingJsonLd), canonical/image absolute URL resolution, author normalization (single vs. multiple), date handling (datePublished/dateModified fallback), and injects the BlogPosting JSON-LD via a script tag into the page.
Layout metadata consolidation
apps/blog/src/app/layout.tsx
Replaces hardcoded metadata with imported constants BLOG_HOME_TITLE and BLOG_HOME_DESCRIPTION to centralize blog metadata.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(blog): add json-ld' directly and clearly describes the main change: adding JSON-LD schema markup to the blog feature.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Tip

CodeRabbit can scan for known vulnerabilities in your dependencies using OSV Scanner.

OSV Scanner will automatically detect and report security vulnerabilities in your project's dependencies. No additional configuration is required.

@argos-ci
Copy link

argos-ci bot commented Mar 13, 2026

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

Build Status Details Updated (UTC)
default (Inspect) 👍 Changes approved 1 changed Mar 14, 2026, 1:31 AM

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/blog/src/app/`(blog)/[slug]/page.tsx:
- Around line 89-91: The current authorNames filter uses Boolean(author?.trim())
which calls trim on non-strings and can keep untrimmed values; update the logic
around page.data.authors so the predicate first narrows to strings (e.g., check
typeof author === "string"), call author.trim() inside the filter to test
emptiness, and then map the result to the trimmed string; modify the authorNames
assignment (the const authorNames) to implement this stronger type-guard and
trimming so authorNames is a string[] of trimmed names.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e0e12150-7202-41c1-ae13-7c6b2bcfde3d

📥 Commits

Reviewing files that changed from the base of the PR and between e3a2e7b and 148677b.

📒 Files selected for processing (2)
  • apps/blog/src/app/(blog)/[slug]/page.tsx
  • apps/blog/src/app/layout.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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)/[slug]/page.tsx (1)

79-80: Prefer falling back to excerpt before skipping JSON-LD.

Line 79/Line 80 currently drop JSON-LD when metaDescription and description are missing, even though the page already has excerpt (Line 204). Using it as a fallback improves coverage without changing schema quality much.

♻️ Suggested patch
-  const description = (page.data.metaDescription ?? page.data.description ?? "").trim();
-  if (!title || !description) return null;
+  const description = (
+    page.data.metaDescription ??
+    page.data.description ??
+    page.data.excerpt ??
+    ""
+  ).trim();
+  if (!title || !description) return null;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/blog/src/app/`(blog)/[slug]/page.tsx around lines 79 - 80, The current
guard returns null when title or description is missing even though
page.data.excerpt exists; update the logic that computes description (currently
using page.data.metaDescription and page.data.description) to also fall back to
page.data.excerpt before short-circuiting; adjust the condition that checks
title/description (symbols: title, description, page.data.metaDescription,
page.data.description, page.data.excerpt) so JSON-LD is emitted when an excerpt
is available instead of returning null.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/blog/src/app/`(blog)/[slug]/page.tsx:
- Around line 79-80: The current guard returns null when title or description is
missing even though page.data.excerpt exists; update the logic that computes
description (currently using page.data.metaDescription and
page.data.description) to also fall back to page.data.excerpt before
short-circuiting; adjust the condition that checks title/description (symbols:
title, description, page.data.metaDescription, page.data.description,
page.data.excerpt) so JSON-LD is emitted when an excerpt is available instead of
returning null.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c050f66b-c9aa-4eca-b107-6388d26fde1c

📥 Commits

Reviewing files that changed from the base of the PR and between 148677b and 6187bf2.

📒 Files selected for processing (1)
  • apps/blog/src/app/(blog)/[slug]/page.tsx

@mhartington mhartington merged commit 5ffdbd5 into main Mar 14, 2026
11 of 12 checks passed
@mhartington mhartington deleted the json-ld branch March 14, 2026 22:49
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