Roo-Code/apps/web-roo-code/src/app/blog/page.tsx
roomote[bot] dc243e4cf9
feat(web): add blog section with initial posts (#11127)
* feat(web): add blog section with 4 initial posts

Implements MKT-66 through MKT-74:

Content Layer (MKT-67):
- Markdown files in src/content/blog with Zod-validated frontmatter
- Pacific Time scheduling evaluated at request-time (no deploy needed)
- gray-matter for parsing, react-markdown + remark-gfm for rendering

Blog Pages (MKT-68, MKT-69):
- Index page at /blog with dynamic SSR
- Post page at /blog/[slug] with dynamic SSR
- Breadcrumb navigation and prev/next post navigation

SEO (MKT-70):
- Full OpenGraph and Twitter card metadata
- Schema.org JSON-LD (Article, BreadcrumbList, CollectionPage)
- Canonical URLs pointing to roocode.com/blog

Analytics (MKT-74):
- PostHog blog_post_viewed and blog_index_viewed events
- Referrer tracking for attribution

Navigation (MKT-72):
- Updated nav-bar and footer to link to internal /blog
- Blog link in Resources dropdown

Sitemap (MKT-71):
- Dynamic blog paths with PT scheduling check

Initial Posts:
- PRDs Are Becoming Artifacts of the Past (Jan 12)
- Code Review Got Faster, Not Easier (Jan 19)
- Vibe Coders Build and Rebuild (Jan 26)
- Async Agents Change the Speed vs Quality Calculus (Feb 2)

* fix(test): update HistoryPreview tests to match refactored component

The HistoryPreview component was refactored to use useGroupedTasks and
TaskGroupItem instead of rendering TaskItem directly. This updates the
test file to properly mock the new dependencies:
- Mock useGroupedTasks hook to provide grouped task data
- Mock TaskGroupItem instead of TaskItem
- Update assertions to test for task groups instead of individual tasks

* feat(blog): add Vercel-inspired patterns and Tone of Voice alignment

- Add reading time display to blog posts
- Create BlogPostCTA component with 4 variants (default, extension, cloud, enterprise)
- Add zebra striping to tables in blog posts
- Add CTA to blog landing and paginated pages
- Remove 'Posted' prefix from dates
- Update blog description: 'How teams use agents to iterate, review, and ship PRs with proof'
- Add BlogPostList and BlogPagination components
- Add 100+ new blog posts from content pipeline

* feat(blog): add source badges for podcast content (Office Hours, After Hours, Roo Cast)

- Add BlogSource type to types.ts
- Export BlogSource from blog index
- Add SourceBadge component to BlogPostList with colored badges
- Each podcast has distinct color: blue (Office Hours), purple (After Hours), emerald (Roo Cast)

* feat(blog): add source field to all blog posts (Roo Cast, Office Hours, After Hours)

- Add add-blog-sources.ts script to build title→source mapping
- Updated 122 blog posts with correct podcast sources
- Sources: Roo Cast (52), Office Hours (62), After Hours (8)

* feat(blog): add source badges with consistent styling

- Add source field to Zod validation schema
- Source badges use same styling as tag badges (rounded, greyscale)
- Badges display on /blog landing page for Office Hours, After Hours, Roo Cast

* feat(blog): improve schema.org structured data for SEO

- Change @type from Article to BlogPosting (more specific)
- Add image property using OG image URL
- Add wordCount for AEO optimization

* feat(blog): timestamped YouTube quotes + attribution polish

* chore(blog): update 'Series A team' to 'Series A - C team' and fix 'Tovin' to 'Tovan'

- Changed 22 instances of 'Series A team' to 'Series A - C team' across 20 blog posts
- Changed 12 instances of 'Tovin' to 'Tovan' across 4 blog posts

This broadens the messaging to better represent teams that Roo Code serves (Series A through C).

* ci: retry CI after timeout

* blog: featured posts + copy edits

* blog: remove draft posts from web content

* fix(blog): loop HTML tag stripping to prevent incomplete sanitization

The single-pass .replace(/<[^>]+>/g, "") in calculateReadingTime() was
flagged by CodeQL as vulnerable to incomplete multi-character sanitization.
Input like "<scr<script>ipt>" would still contain "<script" after one pass.

Added a stripHtmlTags() helper that loops the replacement until stable,
plus a final pass to remove any remaining angle brackets.

* fix(blog): replace iterative HTML tag stripping with single-pass angle bracket removal

The CodeQL scanner flagged the iterative stripHtmlTags function for
incomplete multi-character sanitization. The regex /<[^>]+>/g only
matches complete tags, so partial fragments like <script (without a
closing >) could survive intermediate loop iterations.

Since this function is only used for word counting in
calculateReadingTime, replace the multi-step approach with a simple
single-pass removal of all < and > characters. This eliminates the
incomplete sanitization pattern entirely.

---------

Co-authored-by: Roo Code <roomote@roocode.com>
Co-authored-by: Michael Preuss <michael@roocode.com>
2026-02-16 20:37:54 -05:00

181 lines
4.8 KiB
TypeScript

/**
* Blog Index Page
* MKT-68: Blog Index Page
*
* Lists published blog posts with two views:
* - Featured (default): Curated 24 posts aligned with Roo Code positioning
* - All: Full list with pagination (12 posts per page)
*
* Uses dynamic rendering (force-dynamic) for request-time publish gating.
*/
import type { Metadata } from "next"
import Script from "next/script"
import { Suspense } from "react"
import { getPaginatedBlogPosts, getAllBlogPosts, getCuratedBlogPosts } from "@/lib/blog"
import { SEO } from "@/lib/seo"
import { ogImageUrl } from "@/lib/og"
import { BlogIndexAnalytics } from "@/components/blog/BlogAnalytics"
import { BlogPostList } from "@/components/blog/BlogPostList"
import { BlogPagination } from "@/components/blog/BlogPagination"
import { BlogPostCTA } from "@/components/blog/BlogPostCTA"
import { BlogViewToggle } from "@/components/blog/BlogViewToggle"
// Force dynamic rendering for request-time publish gating
export const dynamic = "force-dynamic"
export const runtime = "nodejs"
const TITLE = "Blog"
const DESCRIPTION = "How teams use agents to iterate, review, and ship PRs with proof."
const PATH = "/blog"
export const metadata: Metadata = {
title: TITLE,
description: DESCRIPTION,
alternates: {
canonical: `${SEO.url}${PATH}`,
},
openGraph: {
title: TITLE,
description: DESCRIPTION,
url: `${SEO.url}${PATH}`,
siteName: SEO.name,
images: [
{
url: ogImageUrl(TITLE, DESCRIPTION),
width: 1200,
height: 630,
alt: TITLE,
},
],
locale: SEO.locale,
type: "website",
},
twitter: {
card: SEO.twitterCard,
title: TITLE,
description: DESCRIPTION,
images: [ogImageUrl(TITLE, DESCRIPTION)],
},
keywords: [...SEO.keywords, "blog", "articles", "engineering", "AI development"],
}
interface Props {
searchParams: Promise<{ view?: string; page?: string }>
}
export default async function BlogIndexPage({ searchParams }: Props) {
const params = await searchParams
const view = params.view === "all" ? "all" : "featured"
const pageParam = params.page ? parseInt(params.page, 10) : 1
// Get all posts for counts and schema
const allPosts = getAllBlogPosts()
const curatedPosts = getCuratedBlogPosts()
// Determine which posts to display based on view
let displayPosts
let currentPage = 1
let totalPages = 1
let showPagination = false
if (view === "all") {
const paginated = getPaginatedBlogPosts(pageParam)
displayPosts = paginated.posts
currentPage = paginated.currentPage
totalPages = paginated.totalPages
showPagination = totalPages > 1
} else {
// Featured view shows curated posts without pagination
displayPosts = curatedPosts
}
// Schema.org CollectionPage + ItemList (includes all posts for SEO)
const blogSchema = {
"@context": "https://schema.org",
"@type": "CollectionPage",
name: TITLE,
description: DESCRIPTION,
url: `${SEO.url}${PATH}`,
mainEntity: {
"@type": "ItemList",
itemListElement: allPosts.map((post, index) => ({
"@type": "ListItem",
position: index + 1,
url: `${SEO.url}/blog/${post.slug}`,
name: post.title,
})),
},
}
// Breadcrumb schema
const breadcrumbSchema = {
"@context": "https://schema.org",
"@type": "BreadcrumbList",
itemListElement: [
{
"@type": "ListItem",
position: 1,
name: "Home",
item: SEO.url,
},
{
"@type": "ListItem",
position: 2,
name: "Blog",
item: `${SEO.url}${PATH}`,
},
],
}
return (
<>
<Script
id="blog-schema"
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(blogSchema) }}
/>
<Script
id="breadcrumb-schema"
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(breadcrumbSchema) }}
/>
<BlogIndexAnalytics />
<div className="container mx-auto px-4 py-12 sm:px-6 lg:px-8">
<div className="mx-auto max-w-4xl">
<h1 className="text-3xl font-bold tracking-tight sm:text-4xl md:text-5xl">Blog</h1>
<p className="mt-4 text-lg text-muted-foreground">{DESCRIPTION}</p>
{/* View Toggle */}
<Suspense
fallback={
<div className="mt-6 flex items-center gap-4">
<div className="h-11 w-64 animate-pulse rounded-lg bg-muted" />
</div>
}>
<BlogViewToggle curatedCount={curatedPosts.length} totalCount={allPosts.length} />
</Suspense>
{/* Post count indicator for "all" view */}
{view === "all" && totalPages > 1 && (
<p className="mt-4 text-sm text-muted-foreground">
Showing {displayPosts.length} of {allPosts.length} posts
</p>
)}
<BlogPostList posts={displayPosts} />
{/* Pagination only for "all" view */}
{showPagination && (
<BlogPagination currentPage={currentPage} totalPages={totalPages} useQueryParams />
)}
{/* Cloud CTA - shown after posts */}
<BlogPostCTA />
</div>
</div>
</>
)
}