The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
www: blog (#47236)
Francesco Sansalvadoreba133afc4c6c
diff --git a/apps/www/app/blog/BlogClient.tsx b/apps/www/app/blog/BlogClient.tsxindex 000942ad3b8..132664c4249 100644--- a/apps/www/app/blog/BlogClient.tsx+++ b/apps/www/app/blog/BlogClient.tsx@@ -1,22 +1,25 @@'use client'-import { isBrowser, LOCAL_STORAGE_KEYS } from 'common'+import { type BlogView } from 'app/blog/blog-view'import BlogFilters from 'components/Blog/BlogFilters'import BlogGridItem from 'components/Blog/BlogGridItem'import BlogListItem from 'components/Blog/BlogListItem'import { useInfiniteScrollWithFetch } from 'hooks/useInfiniteScroll'import { Suspense, useCallback, useState } from 'react'import type PostTypes from 'types/post'-import { cn } from 'ui'-export type BlogView = 'list' | 'grid'+import SectionContainerWithCn from '../../components/Layouts/SectionContainerWithCn'+import SectionContainer from '@/components/Layouts/SectionContainer'const POSTS_PER_PAGE = 25const SKELETON_COUNT = 6+// Featured + 2 secondary posts shown by the layout hero on the index. Excluded+// from the list to avoid duplication — keep in sync with app/blog/layout.tsx.+const HERO_POST_COUNT = 3function BlogListItemSkeleton() {return (- <div className="flex flex-col lg:grid lg:grid-cols-10 xl:grid-cols-12 w-full py-2 sm:py-4 h-full border-b">+ <div className="flex flex-col lg:grid lg:grid-cols-10 xl:grid-cols-12 w-full py-2 sm:py-4 h-full"><div className="flex w-full lg:col-span-8 xl:col-span-8"><div className="h-6 bg-foreground-muted/20 rounded-sm animate-pulse w-3/4" /></div>@@ -38,20 +41,16 @@ function BlogListItemSkeleton() {function BlogGridItemSkeleton() {return (- <div className="inline-block min-w-full p-2 sm:p-4 h-full">- <div className="flex flex-col space-y-2">- <div className="flex flex-col space-y-1">- <div className="relative mb-3 w-full aspect-2/1 lg:aspect-5/3 overflow-hidden rounded-lg border border-default bg-foreground-muted/20 animate-pulse" />- <div className="flex items-center space-x-1.5">- <div className="h-4 w-24 bg-foreground-muted/20 rounded-sm animate-pulse" />- <div className="h-4 w-4 bg-foreground-muted/20 rounded-sm animate-pulse" />- <div className="h-4 w-16 bg-foreground-muted/20 rounded-sm animate-pulse" />- </div>- <div className="h-6 w-3/4 bg-foreground-muted/20 rounded-sm animate-pulse mt-1" />- <div className="h-4 w-full bg-foreground-muted/20 rounded-sm animate-pulse mt-1" />- <div className="h-4 w-2/3 bg-foreground-muted/20 rounded-sm animate-pulse" />- </div>+ <div className="flex flex-col gap-2 p-6">+ <div className="relative w-full aspect-[1.91/1] overflow-hidden bg-foreground-muted/20 animate-pulse" />+ <div className="flex items-center space-x-1.5 mt-2">+ <div className="h-4 w-24 bg-foreground-muted/20 rounded animate-pulse" />+ <div className="h-4 w-4 bg-foreground-muted/20 rounded animate-pulse" />+ <div className="h-4 w-16 bg-foreground-muted/20 rounded animate-pulse" /></div>+ <div className="h-6 w-3/4 bg-foreground-muted/20 rounded animate-pulse mt-1" />+ <div className="h-4 w-full bg-foreground-muted/20 rounded animate-pulse mt-1" />+ <div className="h-4 w-2/3 bg-foreground-muted/20 rounded animate-pulse" /></div>)}@@ -59,12 +58,11 @@ function BlogGridItemSkeleton() {interface BlogClientProps {initialBlogs: any[]totalPosts: number+ initialView: BlogView}-export default function BlogClient({ initialBlogs, totalPosts }: BlogClientProps) {- const { BLOG_VIEW } = LOCAL_STORAGE_KEYS- const localView = isBrowser ? (localStorage?.getItem(BLOG_VIEW) as BlogView) : undefined- const [view, setView] = useState<BlogView>(localView ?? 'list')+export default function BlogClient({ initialBlogs, totalPosts, initialView }: BlogClientProps) {+ const [view, setView] = useState<BlogView>(initialView)const [isFiltering, setIsFiltering] = useState(false)const [filterParams, setFilterParams] = useState<{ category?: string; search?: string }>({})const [filteredPosts, setFilteredPosts] = useState<any[] | null>(null)@@ -76,21 +74,13 @@ export default function BlogClient({ initialBlogs, totalPosts }: BlogClientPropsconst fetchMorePosts = useCallback(async (offset: number, limit: number) => {- const isFiltered =- (filterParams.category && filterParams.category !== 'all') || Boolean(filterParams.search)- // The featured post is rendered above the list (not in `items`), so the- // API offset has to skip past it for unfiltered fetches. Filtered- // results come from a separate query and don't share that hero slot.- const apiOffset = isFiltered ? offset : offset + 1-+ // The hero posts stay in the loaded array (just rendered in the layout+ // hero, sliced off at render), so `offset` already counts them — no skip.const params = new URLSearchParams({- offset: apiOffset.toString(),+ offset: offset.toString(),limit: limit.toString(),})- if (filterParams.category && filterParams.category !== 'all') {- params.set('category', filterParams.category)- }if (filterParams.search) {params.set('q', filterParams.search)}@@ -109,9 +99,7 @@ export default function BlogClient({ initialBlogs, totalPosts }: BlogClientPropsconst {items: blogs,- setItems: setBlogs,hasMore,- isLoading,loadMoreRef,} = useInfiniteScrollWithFetch({initialItems: currentPosts,@@ -160,66 +148,75 @@ export default function BlogClient({ initialBlogs, totalPosts }: BlogClientProps}}, [])+ // The hero posts (the most recent HERO_POST_COUNT) are rendered by the blog+ // layout's hero, so drop them from the list to avoid duplication. Filtered+ // results are a separate query with no hero, so show all.+ const visibleBlogs = filteredPosts !== null ? blogs : blogs.slice(HERO_POST_COUNT)+return (- <>- <Suspense fallback={null}>- <BlogFilters onFilterChange={handleFilterChange} view={view} setView={setView} />- </Suspense>-- <ol- className={cn(- 'grid -mx-2 sm:-mx-4 py-6 lg:py-6 lg:pb-20',- isList ? 'grid-cols-1' : 'grid-cols-12 lg:gap-4'- )}- >+ <div>+ {/* Filters row */}+ <div className="sticky top-[65px] z-10 bg-background/80 backdrop-blur-sm border-b border-border">+ <SectionContainer className="py-0!">+ <div className="py-3">+ <Suspense fallback={null}>+ <BlogFilters onFilterChange={handleFilterChange} view={view} setView={setView} />+ </Suspense>+ </div>+ </SectionContainer>+ </div>++ {/* Blog posts */}+ <SectionContainerWithCn height="none" className="py-6">{isFiltering ? (isList ? (- Array.from({ length: SKELETON_COUNT }).map((_, idx) => (- <div- className="col-span-12 px-2 sm:px-4 [&_a]:last:border-none"- key={`skeleton-list-${idx}`}- >- <BlogListItemSkeleton />- </div>- ))+ <div>+ {Array.from({ length: SKELETON_COUNT }).map((_, idx) => (+ <BlogListItemSkeleton key={`skeleton-list-${idx}`} />+ ))}+ </div>) : (- Array.from({ length: SKELETON_COUNT }).map((_, idx) => (- <div- className="col-span-12 mb-4 md:col-span-12 lg:col-span-6 xl:col-span-4 h-full"- key={`skeleton-grid-${idx}`}- >- <BlogGridItemSkeleton />- </div>- ))+ <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3">+ {Array.from({ length: SKELETON_COUNT }).map((_, idx) => (+ <div key={`skeleton-grid-${idx}`}>+ <BlogGridItemSkeleton />+ </div>+ ))}+ </div>)- ) : blogs?.length ? (- blogs?.map((blog: PostTypes, idx: number) =>- isList ? (- <div- className="col-span-12 px-2 sm:px-4 [&_a]:last:border-none"- key={`list-${idx}-${blog.slug}`}- >- <BlogListItem post={blog} />- </div>- ) : (- <div- className="col-span-12 mb-4 md:col-span-12 lg:col-span-6 xl:col-span-4 h-full"- key={`grid-${idx}-${blog.slug}`}- >- <BlogGridItem post={blog} />- </div>- )+ ) : visibleBlogs?.length ? (+ isList ? (+ <ul aria-label={`Blog posts, ${currentTotal} total`}>+ {visibleBlogs.map((blog: PostTypes, idx: number) => (+ <li key={`list-${idx}-${blog.slug}`}>+ <BlogListItem post={blog} />+ </li>+ ))}+ </ul>+ ) : (+ <ul+ aria-label={`Blog posts, ${currentTotal} total`}+ className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 lg:gap-12 py-4"+ >+ {visibleBlogs.map((blog: PostTypes, idx: number) => (+ <li key={`grid-${idx}-${blog.slug}`}>+ <BlogGridItem post={blog} />+ </li>+ ))}+ </ul>)) : (- <p className="text-sm text-light col-span-full">No results</p>+ <div className="px-6 py-12">+ <p className="text-sm text-light">No results</p>+ </div>)}- </ol>- {hasMore && !isFiltering && (- <div ref={loadMoreRef} className="flex justify-center py-8" aria-hidden="true">- <div className="h-8 w-8 animate-spin rounded-full border-2 border-foreground-muted border-t-foreground" />- </div>- )}- </>+ {hasMore && !isFiltering && (+ <div ref={loadMoreRef} className="flex justify-center py-8" aria-hidden="true">+ <div className="h-8 w-8 animate-spin rounded-full border-2 border-foreground-muted border-t-foreground" />+ </div>+ )}+ </SectionContainerWithCn>+ </div>)}diff --git a/apps/www/app/blog/BlogHero.tsx b/apps/www/app/blog/BlogHero.tsxnew file mode 100644index 00000000000..b3516542b70--- /dev/null+++ b/apps/www/app/blog/BlogHero.tsx@@ -0,0 +1,120 @@+'use client'++import FeaturedThumb from 'components/Blog/FeaturedThumb'+import { motion } from 'framer-motion'+import Image from 'next/image'+import Link from 'next/link'+import { usePathname } from 'next/navigation'+import type PostTypes from 'types/post'++import SectionContainer from '../../components/Layouts/SectionContainer'+import blogAuthors from '@/lib/authors.json'++function SecondarySpotlight({ post }: { post: PostTypes }) {+ const resolveImagePath = (img: string | undefined): string | null => {+ if (!img) return null+ return img.startsWith('/') || img.startsWith('http') ? img : `/images/blog/${img}`+ }+ const imageUrl =+ resolveImagePath(post.imgThumb) ||+ resolveImagePath(post.imgSocial) ||+ '/images/blog/blog-placeholder.png'++ const authorNames = (post.author?.split(',') ?? [])+ .map((id) => blogAuthors.find((a: any) => a.author_id === id.trim())?.author)+ .filter(Boolean)+ .join(', ')++ return (+ <Link+ href={post.path}+ prefetch={false}+ className="group flex gap-4 items-start hover:bg-surface-200 dark:hover:bg-surface-75 p-2 sm:p-4 rounded-xl"+ >+ <div+ className="relative shrink-0 w-36 aspect-[1.91/1] overflow-hidden rounded-md border border-foreground/10"+ aria-hidden="true"+ >+ <Image+ src={imageUrl}+ fill+ sizes="112px"+ quality={80}+ className="object-cover group-hover:scale-[1.03] transition-transform duration-300"+ alt=""+ />+ </div>+ <div className="flex flex-col gap-1 min-w-0">+ <h3 className="text-foreground text-sm leading-snug group-hover:underline line-clamp-3">+ {post.title}+ </h3>+ {post.formattedDate && (+ <p className="text-foreground-lighter text-xs">+ <span className="sr-only">Published </span>+ {post.formattedDate}+ </p>+ )}+ {authorNames && (+ <p className="text-foreground-light text-xs">+ <span className="sr-only">Author: </span>+ {authorNames}+ </p>+ )}+ </div>+ </Link>+ )+}++/**+ * Featured hero for the blog. Rendered by the blog route layout so it stays+ * mounted across navigation between `/blog` and `/blog/categories/*`. It's only+ * meant for the index, so on other blog routes we animate its height to 0 —+ * collapsing it smoothly slides the page content up/down instead of jumping.+ */+export default function BlogHero({+ featuredPost,+ secondaryPosts,+}: {+ featuredPost: PostTypes | null+ secondaryPosts: PostTypes[]+}) {+ const pathname = usePathname()+ // Only mount the hero on the listing routes it animates between (index ⇄+ // category). Elsewhere (posts, tags, authors) it's irrelevant — rendering it+ // would needlessly preload the featured image.+ const isListingRoute = pathname === '/blog' || Boolean(pathname?.startsWith('/blog/categories/'))+ const expanded = pathname === '/blog'++ if (!featuredPost || !isListingRoute) return null++ // When collapsed, `inert` removes the clipped hero (and its links) from the+ // a11y tree and tab order entirely.+ const collapsedProps = expanded ? {} : ({ inert: '' } as any)++ return (+ <motion.div+ {...collapsedProps}+ initial={false}+ animate={{ height: expanded ? 'auto' : 0, opacity: expanded ? 1 : 0 }}+ transition={{ duration: 0.4, ease: [0.22, 1, 0.36, 1] }}+ aria-hidden={!expanded}+ className="overflow-hidden"+ >+ <SectionContainer className="py-6! md:py-8!">+ <FeaturedThumb key={featuredPost.slug} {...featuredPost} />+ {secondaryPosts.length > 0 && (+ <ul+ aria-label="More recent posts"+ className="mt-4 pt-4 border-t border-muted grid grid-cols-1 sm:grid-cols-2 gap-4"+ >+ {secondaryPosts.map((post) => (+ <li key={post.slug}>+ <SecondarySpotlight post={post} />+ </li>+ ))}+ </ul>+ )}+ </SectionContainer>+ </motion.div>+ )+}diff --git a/apps/www/app/blog/BlogLayoutShell.tsx b/apps/www/app/blog/BlogLayoutShell.tsxnew file mode 100644index 00000000000..432edf2d661--- /dev/null+++ b/apps/www/app/blog/BlogLayoutShell.tsx@@ -0,0 +1,28 @@+'use client'++import { usePathname } from 'next/navigation'+import type PostTypes from 'types/post'++import BlogHero from './BlogHero'+import DefaultLayout from '@/components/Layouts/Default'++export default function BlogLayoutShell({+ featuredPost,+ secondaryPosts,+ children,+}: {+ featuredPost: PostTypes | null+ secondaryPosts: PostTypes[]+ children: React.ReactNode+}) {+ const pathname = usePathname()+ const isListingRoute = pathname === '/blog' || Boolean(pathname?.startsWith('/blog/categories/'))++ return (+ <DefaultLayout>+ {isListingRoute && <h1 className="sr-only">Supabase Blog</h1>}+ <BlogHero featuredPost={featuredPost} secondaryPosts={secondaryPosts} />+ {children}+ </DefaultLayout>+ )+}diff --git a/apps/www/app/blog/authors/[author]/AuthorClient.tsx b/apps/www/app/blog/authors/[author]/AuthorClient.tsxindex b14a97d0215..b382cd6e549 100644--- a/apps/www/app/blog/authors/[author]/AuthorClient.tsx+++ b/apps/www/app/blog/authors/[author]/AuthorClient.tsx@@ -1,16 +1,16 @@'use client'-import { isBrowser, LOCAL_STORAGE_KEYS } from 'common'import BlogGridItem from 'components/Blog/BlogGridItem'import BlogListItem from 'components/Blog/BlogListItem'-import DefaultLayout from 'components/Layouts/Default'import { AlignJustify, Grid, Search } from 'lucide-react'import Image from 'next/image'import Link from 'next/link'import { useMemo, useState } from 'react'import type PostTypes from 'types/post'-import { Button, cn, InputGroup, InputGroupAddon, InputGroupInput } from 'ui'+import { Button, InputGroup, InputGroupAddon, InputGroupInput } from 'ui'+import BlogViewToggle from '../../../../components/Blog/BlogViewToggle'+import DefaultLayout from '@/components/Layouts/Default'import SectionContainerWithCn from '@/components/Layouts/SectionContainerWithCn'export type BlogView = 'list' | 'grid'@@ -27,35 +27,29 @@ interface AuthorClientProps {author: Author | nullauthorId: stringblogs: PostTypes[]+ initialView: BlogView}-export default function AuthorClient({ author, authorId, blogs }: AuthorClientProps) {- const { BLOG_VIEW } = LOCAL_STORAGE_KEYS- const localView = isBrowser ? (localStorage?.getItem(BLOG_VIEW) as BlogView) : undefined- const [view, setView] = useState<BlogView>(localView ?? 'list')+export default function AuthorClient({ author, authorId, blogs, initialView }: AuthorClientProps) {+ const [view, setView] = useState<BlogView>(initialView)const [searchTerm, setSearchTerm] = useState('')const isList = view === 'list'+ const handleViewSelection = () => setView(isList ? 'grid' : 'list')+const filteredBlogs = useMemo(() => {if (!searchTerm) return blogsconst term = searchTerm.toLowerCase()return blogs.filter((blog) =>(blog.title ?? '').toLowerCase().includes(term) ||- (blog.description ?? '').toLowerCase().includes(term)+ (blog.description ?? '').toLowerCase().includes(term) ||+ (blog.author ?? '').toLowerCase().includes(term))}, [blogs, searchTerm])- const handleViewSelection = () => {- setView((prevView) => {- const newValue = prevView === 'list' ? 'grid' : 'list'- localStorage.setItem(BLOG_VIEW, newValue)- return newValue- })- }-return (- <DefaultLayout>+ <><SectionContainerWithCn height="narrow" className="space-y-6"><div className="text-foreground-lighter flex space-x-1"><h1 className="cursor-pointer">@@ -100,9 +94,10 @@ export default function AuthorClient({ author, authorId, blogs }: AuthorClientPr)}</SectionContainerWithCn>+ {/* Filters row — divider above the header, search aligned with the view toggle */}<div className="border-default border-t">- <SectionContainerWithCn height="narrow">- <div className="flex flex-row items-center justify-between gap-2 mb-6">+ <SectionContainerWithCn height="none" className="py-6">+ <div className="flex flex-row items-center justify-between gap-2"><div className="flex-1 max-w-[280px]"><InputGroup className="w-full"><InputGroupInput@@ -118,54 +113,37 @@ export default function AuthorClient({ author, authorId, blogs }: AuthorClientPr</InputGroupAddon></InputGroup></div>- <Button- variant="default"- title={isList ? 'Grid View' : 'List View'}- onClick={handleViewSelection}- className="h-full p-2 text-foreground-light"- >- {isList ? (- <Grid className="w-4 h-4 stroke-1.5" />- ) : (- <AlignJustify className="w-4 h-4 stroke-1.5" />- )}- </Button>+ <BlogViewToggle view={view} setView={setView} /></div>+ </SectionContainerWithCn>+ </div>- {filteredBlogs.length > 0 ? (- <ol- className={cn(- 'grid -mx-2 sm:-mx-4 py-6 lg:py-6 lg:pb-20',- isList ? 'grid-cols-1' : 'grid-cols-12 lg:gap-4'- )}- >- {filteredBlogs.map((blog: PostTypes, idx: number) =>- isList ? (- <div- className="col-span-12 px-2 sm:px-4 [&_a]:last:border-none"- key={`list-${idx}-${blog.slug}`}- >- <BlogListItem post={blog} />- </div>- ) : (- <div- className="col-span-12 mb-4 md:col-span-12 lg:col-span-6 xl:col-span-4 h-full"- key={`grid-${idx}-${blog.slug}`}- >- <BlogGridItem post={blog} />- </div>- )- )}- </ol>+ {/* Posts */}+ <SectionContainerWithCn height="none">+ {filteredBlogs.length > 0 ? (+ isList ? (+ <div>+ {filteredBlogs.map((blog, idx) => (+ <BlogListItem post={blog} key={`list-${idx}-${blog.slug}`} />+ ))}+ </div>) : (- <p className="text-foreground-lighter py-8">+ <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 lg:gap-12 py-4">+ {filteredBlogs.map((blog, idx) => (+ <BlogGridItem post={blog} key={`grid-${idx}-${blog.slug}`} />+ ))}+ </div>+ )+ ) : (+ <div className="px-6 py-12">+ <p className="text-sm text-light">{searchTerm? 'No posts found matching your search.': 'No posts found by this author.'}</p>- )}- </SectionContainerWithCn>- </div>- </DefaultLayout>+ </div>+ )}+ </SectionContainerWithCn>+ </>)}diff --git a/apps/www/app/blog/authors/[author]/page.tsx b/apps/www/app/blog/authors/[author]/page.tsxindex a60a1ea5272..342be9b46ee 100644--- a/apps/www/app/blog/authors/[author]/page.tsx+++ b/apps/www/app/blog/authors/[author]/page.tsx@@ -1,4 +1,7 @@+import { BLOG_VIEW_COOKIE, isBlogView, type BlogView } from 'app/blog/blog-view'import type { Metadata } from 'next'+import { cookies } from 'next/headers'+import { notFound } from 'next/navigation'import AuthorClient from './AuthorClient'import blogAuthors from '@/lib/authors.json'@@ -21,13 +24,6 @@ function toCanonicalAuthorId(identifier: string): string {return authorIdLookup.get(identifier) ?? identifier}-export async function generateStaticParams() {- return blogAuthors.map((author) => ({ author: author.author_id }))-}--export const revalidate = 30-export const dynamic = 'force-static'-export async function generateMetadata({params: paramsPromise,}: {@@ -47,6 +43,15 @@ export default async function AuthorPage({ params: paramsPromise }: { params: Prconst authorId = params.authorconst author = blogAuthors.find((a) => a.author_id === authorId) ?? null+ if (!author) {+ notFound()+ }++ // Read the list/grid preference from a cookie so the correct view renders on+ // first paint. Reading a cookie opts this route into dynamic rendering.+ const cookieStore = await cookies()+ const cookieView = cookieStore.get(BLOG_VIEW_COOKIE)?.value+ const initialView: BlogView = isBlogView(cookieView) ? cookieView : 'list'// Get static posts where author field contains this author_id (normalize identifiers)const staticPosts = getSortedPosts({ directory: '_blog', limit: 0 }).filter((post: any) => {@@ -58,5 +63,13 @@ export default async function AuthorPage({ params: paramsPromise }: { params: Pr(a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()) as unknown as PostTypes[]- return <AuthorClient author={author} authorId={authorId} blogs={blogs} />+ return (+ <AuthorClient+ key={authorId}+ author={author}+ authorId={authorId}+ blogs={blogs}+ initialView={initialView}+ />+ )}diff --git a/apps/www/app/blog/blog-view.ts b/apps/www/app/blog/blog-view.tsnew file mode 100644index 00000000000..00f27783954--- /dev/null+++ b/apps/www/app/blog/blog-view.ts@@ -0,0 +1,17 @@+export type BlogView = 'list' | 'grid'++export const BLOG_VIEW_COOKIE = 'blog-view'++export function isBlogView(value: string | undefined | null): value is BlogView {+ return value === 'list' || value === 'grid'+}++/**+ * Persist the list/grid preference in a cookie so the server can render the+ * correct view on the next load. Storing it client-side (localStorage) caused a+ * hydration flicker: the server rendered the default `list`, then the client+ * swapped to `grid`. Client-side only — call from an event handler.+ */+export function setBlogViewCookie(view: BlogView) {+ document.cookie = `${BLOG_VIEW_COOKIE}=${view}; path=/; max-age=31536000; samesite=lax`+}diff --git a/apps/www/app/blog/categories/[category]/CategoryClient.tsx b/apps/www/app/blog/categories/[category]/CategoryClient.tsxnew file mode 100644index 00000000000..ec4b6237eea--- /dev/null+++ b/apps/www/app/blog/categories/[category]/CategoryClient.tsx@@ -0,0 +1,41 @@+'use client'++import { type BlogView } from 'app/blog/blog-view'+import BlogFilters from 'components/Blog/BlogFilters'+import BlogListingClient from 'components/Blog/BlogListingClient'+import { Suspense, useState } from 'react'+import type PostTypes from 'types/post'++import SectionContainer from '@/components/Layouts/SectionContainer'++interface Props {+ posts: PostTypes[]+ initialView: BlogView+ category: string+}++export default function CategoryClient({ posts, initialView, category: _category }: Props) {+ const [view, setView] = useState<BlogView>(initialView)+ const [searchTerm, setSearchTerm] = useState('')++ return (+ <>+ <div className="sticky top-[65px] z-10 bg-background/80 backdrop-blur-sm border-b border-border">+ <SectionContainer className="py-3!">+ <Suspense fallback={null}>+ <BlogFilters view={view} setView={setView} onSearch={setSearchTerm} />+ </Suspense>+ </SectionContainer>+ </div>++ <div className="my-6">+ <BlogListingClient+ posts={posts}+ initialView={initialView}+ view={view}+ searchTerm={searchTerm}+ />+ </div>+ </>+ )+}diff --git a/apps/www/app/blog/categories/[category]/page.tsx b/apps/www/app/blog/categories/[category]/page.tsxindex 46ec30651c0..b2fbac3d7d7 100644--- a/apps/www/app/blog/categories/[category]/page.tsx+++ b/apps/www/app/blog/categories/[category]/page.tsx@@ -1,23 +1,15 @@+import { BLOG_VIEW_COOKIE, isBlogView, type BlogView } from 'app/blog/blog-view'import type { Metadata } from 'next'-import Link from 'next/link'+import { cookies } from 'next/headers'+import { notFound } from 'next/navigation'-import BlogGridItem from '@/components/Blog/BlogGridItem'-import DefaultLayout from '@/components/Layouts/Default'-import SectionContainer from '@/components/Layouts/SectionContainer'+import CategoryClient from './CategoryClient'import { capitalize } from '@/lib/helpers'import { getAllCategories, getSortedPosts } from '@/lib/posts'import type PostTypes from '@/types/post'type Params = { category: string }-export async function generateStaticParams() {- const categories = getAllCategories('_blog')- return categories.map((category: string) => ({ category }))-}--export const revalidate = 30-export const dynamic = 'force-static'-export async function generateMetadata({params: paramsPromise,}: {@@ -39,37 +31,33 @@ export default async function CategoriesPage({}) {const params = await paramsPromise+ if (!getAllCategories('_blog').includes(params.category)) {+ notFound()+ }++ // Read the list/grid preference from a cookie so the correct view renders on+ // first paint. Reading a cookie opts this route into dynamic rendering.+ const cookieStore = await cookies()+ const cookieView = cookieStore.get(BLOG_VIEW_COOKIE)?.value+ const initialView: BlogView = isBlogView(cookieView) ? cookieView : 'list'+const staticPosts = getSortedPosts({directory: '_blog',limit: 0,categories: [params.category],})const blogs = [...staticPosts] as PostTypes[]- const capitalizedCategory = capitalize(params?.category.replaceAll('-', ' '))+ const capitalizedCategory = capitalize(params.category.replaceAll('-', ' '))++ // Key by category so state (search term, view) resets when switching between+ // category pages rather than persisting across the reused page component.return (- <>- <DefaultLayout>- <SectionContainer>- <div className="text-foreground-lighter flex space-x-1">- <h1 className="cursor-pointer">- <Link href="/blog">Blog</Link>- <span className="px-2">/</span>- <span>{capitalizedCategory}</span>- </h1>- </div>- <ol className="grid grid-cols-12 gap-8 py-16 lg:gap-16">- {blogs.map((blog: PostTypes) => (- <div- className="col-span-12 mb-16 md:col-span-12 lg:col-span-6 xl:col-span-4"- key={blog.slug}- >- <BlogGridItem post={blog} />- </div>- ))}- </ol>- </SectionContainer>- </DefaultLayout>- </>+ <CategoryClient+ key={params.category}+ posts={blogs}+ initialView={initialView}+ category={capitalizedCategory}+ />)}diff --git a/apps/www/app/blog/layout.tsx b/apps/www/app/blog/layout.tsxnew file mode 100644index 00000000000..cfdd17be247--- /dev/null+++ b/apps/www/app/blog/layout.tsx@@ -0,0 +1,23 @@+import BlogLayoutShell from './BlogLayoutShell'+import { getSortedPosts } from '@/lib/posts'+import type PostTypes from '@/types/post'++export default async function BlogLayout({ children }: { children: React.ReactNode }) {+ // Fetched once in the (persistent) layout so the featured hero survives+ // navigation between blog routes and can animate its height on change.+ const staticPosts = getSortedPosts({ directory: '_blog' })+ const sorted = [...staticPosts].sort((a, b) => {+ const aDate = new Date(a.date || a.formattedDate).getTime()+ const bDate = new Date(b.date || b.formattedDate).getTime()+ return bDate - aDate+ })++ const featuredPost = (sorted[0] ?? null) as PostTypes | null+ const secondaryPosts = sorted.slice(1, 3) as PostTypes[]++ return (+ <BlogLayoutShell featuredPost={featuredPost} secondaryPosts={secondaryPosts}>+ {children}+ </BlogLayoutShell>+ )+}diff --git a/apps/www/app/blog/page.tsx b/apps/www/app/blog/page.tsxindex 90dfa267e2a..b2db57ca62c 100644--- a/apps/www/app/blog/page.tsx+++ b/apps/www/app/blog/page.tsx@@ -1,16 +1,13 @@-import FeaturedThumb from 'components/Blog/FeaturedThumb'-import DefaultLayout from 'components/Layouts/Default'import type { Metadata } from 'next'-import type PostTypes from 'types/post'+import { cookies } from 'next/headers'+import { BLOG_VIEW_COOKIE, isBlogView, type BlogView } from './blog-view'import BlogClient from './BlogClient'import SectionContainer from '@/components/Layouts/SectionContainer'import { breadcrumbs } from '@/lib/breadcrumbs'import { breadcrumbListSchema, serializeJsonLd } from '@/lib/json-ld'import { getSortedPosts } from '@/lib/posts'-export const revalidate = 30-export const metadata: Metadata = {title: 'Supabase Blog: the Postgres development platform',description: 'Get all your Supabase News on the Supabase blog.',@@ -33,13 +30,16 @@ export default async function BlogPage() {return dateB - dateA})+ // The featured post + secondary spotlights are derived from the head of this+ // list inside BlogClient; chrome (nav, footer, container) comes from the blog+ // route's layout.tsx.const initialPosts = allPosts.slice(0, INITIAL_POSTS_LIMIT)- const featuredPost = initialPosts[0]- // Featured post is rendered as the hero above the list, so exclude it from- // the list to avoid showing it twice. BlogClient compensates the API offset- // when scrolling for more posts.- const listPosts = initialPosts.slice(1)- const totalListPosts = Math.max(0, allPosts.length - 1)++ // Render the list/grid view from a cookie so it matches the user's choice on+ // first paint (avoids the localStorage hydration flicker).+ const cookieStore = await cookies()+ const cookieView = cookieStore.get(BLOG_VIEW_COOKIE)?.value+ const initialView: BlogView = isBlogView(cookieView) ? cookieView : 'list'return (<>@@ -49,20 +49,11 @@ export default async function BlogPage() {__html: serializeJsonLd(breadcrumbListSchema(breadcrumbs.blogIndex)),}}/>- <DefaultLayout>- <h1 className="sr-only">Supabase blog</h1>- <SectionContainer className="py-4 md:py-8 xl:py-10!">- {featuredPost && (- <FeaturedThumb key={featuredPost.slug} {...(featuredPost as PostTypes)} />- )}- </SectionContainer>-- <div className="border-default border-t">- <SectionContainer className="py-4 md:py-8 xl:py-10">- <BlogClient initialBlogs={listPosts} totalPosts={totalListPosts} />- </SectionContainer>- </div>- </DefaultLayout>+ <BlogClient+ initialBlogs={initialPosts}+ totalPosts={allPosts.length}+ initialView={initialView}+ /></>)}diff --git a/apps/www/app/blog/tags/[tag]/TagClient.tsx b/apps/www/app/blog/tags/[tag]/TagClient.tsxnew file mode 100644index 00000000000..a17e1c9da60--- /dev/null+++ b/apps/www/app/blog/tags/[tag]/TagClient.tsx@@ -0,0 +1,33 @@+'use client'++import { type BlogView } from 'app/blog/blog-view'+import BlogListingClient from 'components/Blog/BlogListingClient'+import Link from 'next/link'+import type PostTypes from 'types/post'++import SectionContainerWithCn from '@/components/Layouts/SectionContainerWithCn'++interface Props {+ posts: PostTypes[]+ initialView: BlogView+ tag: string+}++export default function TagClient({ posts, initialView, tag }: Props) {+ return (+ <>+ <SectionContainerWithCn height="narrow" className="space-y-6">+ <div className="text-foreground-lighter flex space-x-1">+ <h1>+ <Link href="/blog">Blog</Link>+ <span className="px-2">/</span>+ <span>Tags</span>+ <span className="px-2">/</span>+ <span className="text-foreground">{tag}</span>+ </h1>+ </div>+ </SectionContainerWithCn>+ <BlogListingClient posts={posts} initialView={initialView} />+ </>+ )+}diff --git a/apps/www/app/blog/tags/[tag]/page.tsx b/apps/www/app/blog/tags/[tag]/page.tsxindex 96a665730b3..2b8f30be755 100644--- a/apps/www/app/blog/tags/[tag]/page.tsx+++ b/apps/www/app/blog/tags/[tag]/page.tsx@@ -1,9 +1,8 @@+import { BLOG_VIEW_COOKIE, isBlogView, type BlogView } from 'app/blog/blog-view'import type { Metadata } from 'next'-import Link from 'next/link'+import { cookies } from 'next/headers'-import BlogGridItem from '@/components/Blog/BlogGridItem'-import DefaultLayout from '@/components/Layouts/Default'-import SectionContainer from '@/components/Layouts/SectionContainer'+import TagClient from './TagClient'import { capitalize } from '@/lib/helpers'import { getAllTags, getSortedPosts } from '@/lib/posts'import type PostTypes from '@/types/post'@@ -15,9 +14,6 @@ export async function generateStaticParams() {return tags.map((tag: string) => ({ tag }))}-export const revalidate = 30-export const dynamic = 'force-static'-export async function generateMetadata({params: paramsPromise,}: {@@ -35,33 +31,13 @@ export async function generateMetadata({export default async function TagPage({ params: paramsPromise }: { params: Promise<Params> }) {const params = await paramsPromise+ const cookieStore = await cookies()+ const cookieView = cookieStore.get(BLOG_VIEW_COOKIE)?.value+ const initialView: BlogView = isBlogView(cookieView) ? cookieView : 'list'+const staticPosts = getSortedPosts({ directory: '_blog', limit: 0, tags: [params.tag] })const blogs = [...staticPosts] as PostTypes[]const capitalizedTag = capitalize(params?.tag.replaceAll('-', ' '))- return (- <>- <DefaultLayout>- <SectionContainer>- <div className="text-foreground-lighter flex space-x-1">- <h1 className="cursor-pointer">- <Link href="/blog">Blog</Link>- <span className="px-2">/</span>- <span>{capitalizedTag}</span>- </h1>- </div>- <ol className="grid grid-cols-12 gap-8 py-16 lg:gap-16">- {blogs.map((blog: PostTypes) => (- <div- className="col-span-12 mb-16 md:col-span-12 lg:col-span-6 xl:col-span-4"- key={blog.slug}- >- <BlogGridItem post={blog} />- </div>- ))}- </ol>- </SectionContainer>- </DefaultLayout>- </>- )+ return <TagClient key={params.tag} posts={blogs} initialView={initialView} tag={capitalizedTag} />}diff --git a/apps/www/components/Blog/AuthorAvatars.tsx b/apps/www/components/Blog/AuthorAvatars.tsxnew file mode 100644index 00000000000..a0da27b8002--- /dev/null+++ b/apps/www/components/Blog/AuthorAvatars.tsx@@ -0,0 +1,47 @@+import Image from 'next/image'++import type Author from '@/types/author'++interface Props {+ authors: (Author | undefined)[]+ showName?: boolean+ size?: 'sm' | 'md'+}++export default function AuthorAvatars({ authors, showName = true, size = 'sm' }: Props) {+ const valid = authors.filter(Boolean) as Author[]+ if (!valid.length) return null++ const px = size === 'md' ? 'w-6 h-6' : 'w-5 h-5'++ return (+ <div className="flex items-center gap-2">+ <div className="flex items-center -space-x-1.5">+ {valid.map((author, i) => (+ <div+ key={i}+ className={`relative ${px} rounded-full ring-2 ring-background border border-foreground/20 overflow-hidden shrink-0`}+ >+ {author.author_image_url && (+ <Image+ src={+ typeof author.author_image_url === 'string'+ ? author.author_image_url+ : (author.author_image_url as { url: string }).url+ }+ fill+ className="object-cover"+ alt={showName ? '' : author.author}+ />+ )}+ </div>+ ))}+ </div>+ {showName && (+ <p className="text-foreground-lighter text-xs truncate">+ {valid.map((a) => a.author).join(', ')}+ </p>+ )}+ </div>+ )+}diff --git a/apps/www/components/Blog/BlogFilters.tsx b/apps/www/components/Blog/BlogFilters.tsxindex f6cdba02e6e..0941f3e0486 100644--- a/apps/www/components/Blog/BlogFilters.tsx+++ b/apps/www/components/Blog/BlogFilters.tsx@@ -1,10 +1,13 @@'use client'-import type { BlogView } from 'app/blog/BlogClient'-import { LOCAL_STORAGE_KEYS, useBreakpoint } from 'common'+import { type BlogView } from 'app/blog/blog-view'+import { useBreakpoint } from 'common'+import BlogViewToggle from 'components/Blog/BlogViewToggle'+import { motion } from 'framer-motion'import { startCase } from 'lib/helpers'-import { AlignJustify, ChevronDown, X as CloseIcon, Grid, Search } from 'lucide-react'-import { useRouter, useSearchParams } from 'next/navigation'+import { ChevronDown, X as CloseIcon, Search } from 'lucide-react'+import Link from 'next/link'+import { usePathname, useRouter, useSearchParams } from 'next/navigation'import { useCallback, useEffect, useState } from 'react'import {Button,@@ -20,68 +23,73 @@ import {} from 'ui'interface Props {- onFilterChange: (category?: string, search?: string) => voidview: BlogViewsetView: (view: any) => void+ /**+ * Blog index search: keeps the query in the URL (`?q=`) and filters the full+ * post set client-side via the index's fetch logic.+ */+ onFilterChange?: (category?: string, search?: string) => void+ /**+ * Category-page search: filters the in-memory posts for the current category.+ * No URL sync / fetch. Mutually exclusive with `onFilterChange`.+ */+ onSearch?: (term: string) => void}-/**- * ✅ search via text input- * ✅ update searchTerm when deleting text input- * ✅ search via q param- * ✅ search via category if no q param- * ✅ search via category and reset q param if present- */--function BlogFilters({ onFilterChange, view, setView }: Props) {- const { BLOG_VIEW } = LOCAL_STORAGE_KEYS- const isList = view === 'list'- const [category, setCategory] = useState<string>('all')+// Hard-coded so they can be curated/reordered. Each (except "all") maps to a+// statically generated /blog/categories/<category> page, so selecting a+// category is a navigation (prefetched, no client fetch / skeleton flash).+const allCategories = [+ 'all',+ 'product',+ 'company',+ 'postgres',+ 'developers',+ 'engineering',+ 'launch-week',+]++const categoryHref = (category: string) =>+ category === 'all' ? '/blog' : `/blog/categories/${category}`++const categoryLabel = (category: string) =>+ category === 'all' ? 'All' : startCase(category.replaceAll('-', ' '))++function BlogFilters({ view, setView, onFilterChange, onSearch }: Props) {+ const showSearch = Boolean(onFilterChange) || Boolean(onSearch)const [searchTerm, setSearchTerm] = useState<string>('')const [showSearchInput, setShowSearchInput] = useState<boolean>(false)const router = useRouter()+ const pathname = usePathname()const searchParams = useSearchParams()const q = searchParams?.get('q')- const activeCategory = searchParams?.get('category')const isMobile = useBreakpoint(1023)- const is2XL = useBreakpoint(1535)- // Use hard-coded categories here as they:- // - serve as a reference- // - are easier to reorder- const allCategories = [- 'all',- 'product',- 'company',- 'postgres',- 'developers',- 'engineering',- 'launch-week',- ]+ // Active category is derived from the URL: /blog or /blog/categories/<cat>.+ const categoryMatch = pathname?.match(/^\/blog\/categories\/([^/]+)/)+ const activeCategory = categoryMatch?.[1] ?? 'all'- // Debounced filter change to avoid too many API calls+ // Debounced search to avoid too many API callsconst debouncedFilterChange = useCallback((() => {let timeoutId: NodeJS.Timeout- return (cat: string, search: string) => {+ return (search: string) => {clearTimeout(timeoutId)timeoutId = setTimeout(() => {- onFilterChange(cat, search)+ onFilterChange?.(undefined, search)}, 300)}})(),[onFilterChange])- // Handle URL params on mount+ // Reflect ?q= deep links into the search state on mount (index only)useEffect(() => {- if (q) {+ if (onFilterChange && q) {setSearchTerm(q)- onFilterChange(category, q)- } else if (activeCategory && activeCategory !== 'all') {- setCategory(activeCategory)- onFilterChange(activeCategory, '')+ onFilterChange(undefined, q)}}, []) // Only run on mount@@ -89,17 +97,18 @@ function BlogFilters({ onFilterChange, view, setView }: Props) {(text: string) => {setSearchTerm(text)- // Update URL- if (text.length > 0) {- router?.replace(`/blog?q=${text}`, { scroll: false })+ if (onFilterChange) {+ // Index: keep the query in the URL and filter the full list (debounced).+ router?.replace(text.length > 0 ? `/blog?q=${encodeURIComponent(text)}` : '/blog', {+ scroll: false,+ })+ debouncedFilterChange(text)} else {- router?.replace('/blog', { scroll: false })+ // Category: filter the in-memory posts; no URL change.+ onSearch?.(text)}-- // Trigger filter change (debounced)- debouncedFilterChange(category, text)},- [category, router, debouncedFilterChange]+ [router, debouncedFilterChange, onFilterChange, onSearch])useEffect(() => {@@ -116,43 +125,9 @@ function BlogFilters({ onFilterChange, view, setView }: Props) {setShowSearchInput(!isMobile)}, [isMobile])- const handleSetCategory = useCallback(- (newCategory: string) => {- setSearchTerm('')- setCategory(newCategory)-- // Update URL- if (newCategory === 'all') {- router?.replace('/blog', { scroll: false })- } else {- router?.replace(`/blog?category=${newCategory}`, { scroll: false })- }-- // Trigger filter change immediately for category changes- onFilterChange(newCategory, '')- },- [router, onFilterChange]- )-- const handleSearchChange = useCallback(- (event: any) => {- setCategory('all')- handleSearchByText(event.target.value)- },- [handleSearchByText]- )-- const handleViewSelection = () => {- setView((prevView: 'list' | 'grid') => {- const newValue = prevView === 'list' ? 'grid' : 'list'- localStorage.setItem(BLOG_VIEW, newValue)-- return newValue- })- }-return (<div className="flex flex-row items-center justify-between gap-2">+ {/* Mobile: category dropdown (hidden on lg+) */}{!showSearchInput && (<div className="flex lg:hidden"><DropdownMenu>@@ -162,65 +137,72 @@ function BlogFilters({ onFilterChange, view, setView }: Props) {iconRight={<ChevronDown />}className="w-full min-w-[200px] flex justify-between items-center py-2">- {!activeCategory ? 'All Posts' : startCase(activeCategory?.replaceAll('-', ' '))}+ {activeCategory === 'all' ? 'All Posts' : categoryLabel(activeCategory)}</Button></DropdownMenuTrigger><DropdownMenuContent side="bottom" align="start">- {allCategories.map((category: string, i: number) => (+ {allCategories.map((category) => (<DropdownMenuItem- key={`item-${category}-${- // biome-ignore lint/suspicious/noArrayIndexKey: to disambiguate emtpy values- i- }`}- onClick={() => handleSetCategory(category)}- className={cn(- (category === 'all' && !activeCategory) || category === activeCategory- ? 'text-brand-600'- : ''- )}+ key={category}+ onClick={() => router.push(categoryHref(category))}+ className={cn(category === activeCategory ? 'text-brand-600' : '')}>- {category === 'all' ? 'All Posts' : startCase(category.replaceAll('-', ' '))}+ {category === 'all' ? 'All Posts' : categoryLabel(category)}</DropdownMenuItem>))}</DropdownMenuContent></DropdownMenu></div>)}- <div className="hidden lg:flex flex-wrap items-center grow gap-2">- {allCategories.map((category: string) => (- <Button- key={category}- variant={- category === 'all' && !searchTerm && !activeCategory- ? 'default'- : category === activeCategory- ? 'default'- : 'outline'- }- onClick={() => handleSetCategory(category)}- size={is2XL ? 'tiny' : 'small'}- className="rounded-full"- >- {category === 'all' ? 'All' : startCase(category.replaceAll('-', ' '))}- </Button>- ))}++ {/* Desktop: category pills */}+ <div className="hidden lg:flex flex-wrap items-center grow gap-1">+ {allCategories.map((category) => {+ const isActive = category === activeCategory+ return (+ <Link+ key={category}+ href={categoryHref(category)}+ aria-label={+ category === 'all'+ ? 'Show all blog posts'+ : `Filter blog posts by category: ${categoryLabel(category)}`+ }+ aria-current={isActive ? 'page' : undefined}+ className={cn(+ 'relative px-3 py-1.5 text-sm rounded-full transition-colors',+ isActive ? 'text-foreground' : 'text-foreground-lighter hover:text-foreground-light'+ )}+ >+ {isActive && (+ <motion.span+ layoutId="blog-cat-bg"+ className="absolute inset-0 rounded-full bg-surface-300 border border-border"+ transition={{ type: 'spring', duration: 0.35, bounce: 0.15 }}+ />+ )}+ <span className="relative z-10">{categoryLabel(category)}</span>+ </Link>+ )+ })}</div>- {!showSearchInput && (+ {/* Search (index only) */}+ {showSearch && !showSearchInput && (<div className="flex-1 flex justify-end">- {' '}<ButtonclassName="px-2 h-full"size="medium"variant="default"+ aria-label="Search posts"onClick={() => setShowSearchInput(true)}>- <Search size="14" />+ <Search size="14" aria-hidden="true" /></Button></div>)}- {showSearchInput && (+ {showSearch && showSearchInput && (<div className="w-full h-auto flex justify-end gap-2 items-stretch lg:max-w-[240px] xl:max-w-[280px]"><InputGroup className="w-full"><InputGroupInput@@ -229,10 +211,10 @@ function BlogFilters({ onFilterChange, view, setView }: Props) {type="search"placeholder="Search blog"value={searchTerm}- onChange={handleSearchChange}+ onChange={(event) => handleSearchByText(event.target.value)}/><InputGroupAddon>- <Search />+ <Search aria-hidden="true" /></InputGroupAddon>{isMobile && (<InputGroupAddon align="inline-end">@@ -249,18 +231,9 @@ function BlogFilters({ onFilterChange, view, setView }: Props) {</InputGroup></div>)}- <Button- variant="default"- title={isList ? 'Grid View' : 'List View'}- onClick={handleViewSelection}- className="h-full p-2 text-foreground-light"- >- {isList ? (- <Grid className="w-4 h-4 stroke-1.5" />- ) : (- <AlignJustify className="w-4 h-4 stroke-1.5" />- )}- </Button>++ {/* View toggle */}+ <BlogViewToggle view={view} setView={setView} /></div>)}diff --git a/apps/www/components/Blog/BlogGridItem.tsx b/apps/www/components/Blog/BlogGridItem.tsxindex 63357185e94..e95dbdd0c76 100644--- a/apps/www/components/Blog/BlogGridItem.tsx+++ b/apps/www/components/Blog/BlogGridItem.tsx@@ -2,12 +2,9 @@ import dayjs from 'dayjs'import Image from 'next/image'import Link from 'next/link'+import AuthorAvatars from './AuthorAvatars'import authors from '@/lib/authors.json'-import {- BLOG_GRID_IMAGE_SIZES,- BLOG_PLACEHOLDER_IMAGE,- getBlogThumbnailImage,-} from '@/lib/blog-images'+import { BLOG_PLACEHOLDER_IMAGE, getBlogThumbnailImage } from '@/lib/blog-images'import type Author from '@/types/author'import type PostTypes from '@/types/post'@@ -32,36 +29,33 @@ const BlogGridItem = ({ post }: Props) => {const imageUrl = getBlogThumbnailImage(post) ?? BLOG_PLACEHOLDER_IMAGEreturn (- <Link- href={post.path}- prefetch={false}- className="group inline-block min-w-full p-2 sm:p-4 h-full border border-transparent transition-all hover:bg-surface-200 dark:hover:bg-surface-75 rounded-xl"- >- <div className="flex flex-col space-y-2">- <div className="flex flex-col space-y-1">- <div className="border-default relative mb-3 w-full aspect-[1.91/1] overflow-hidden rounded-lg border shadow-xs">- <Image- fill- sizes={BLOG_GRID_IMAGE_SIZES}- src={imageUrl}- className="scale-100 object-cover overflow-hidden"- alt={`${post.title} thumbnail`}- />+ <Link href={post.path} prefetch={false} className="group flex flex-col h-full">+ <div+ className="relative w-full aspect-[1.91/1] overflow-hidden rounded-md border border-foreground/10"+ aria-hidden="true"+ >+ <Image fill sizes="100%" quality={100} src={imageUrl} className="object-cover" alt="" />+ </div>+ <div className="flex flex-col gap-1 pt-4">+ <h3 className="text-foreground text-lg group-hover:underline">{post.title}</h3>+ <p className="text-foreground-lighter text-sm mt-1 line-clamp-2">{post.description}</p>+ {post.date && (+ <div className="text-foreground-lighter flex items-center space-x-1.5 text-[11px] mt-3">+ <p>+ <span className="sr-only">Published </span>+ {dayjs(post.date).format('D MMM YYYY')}+ </p>+ {post.readingTime && (+ <>+ <p aria-hidden="true">•</p>+ <p>{post.readingTime}</p>+ </>+ )}</div>-- {post.date && (- <div className="text-foreground-lighter flex items-center space-x-1.5 text-sm">- <p>{dayjs(post.date).format('D MMM YYYY')}</p>- {post.readingTime && (- <>- <p>·</p>- <p>{post.readingTime}</p>- </>- )}- </div>- )}- <h3 className="text-foreground max-w-sm text-xl">{post.title}</h3>- <p className="text-foreground-light max-w-sm text-base mb-0!">{post.description}</p>+ )}+ <div className="mt-1.5">+ <span className="sr-only">Author: </span>+ <AuthorAvatars authors={author} /></div></div></Link>diff --git a/apps/www/components/Blog/BlogListItem.tsx b/apps/www/components/Blog/BlogListItem.tsxindex d5b19ae748d..3fbd675c67d 100644--- a/apps/www/components/Blog/BlogListItem.tsx+++ b/apps/www/components/Blog/BlogListItem.tsx@@ -1,9 +1,9 @@import dayjs from 'dayjs'-import Image from 'next/image'import Link from 'next/link'import React from 'react'import { Badge } from 'ui'+import AuthorAvatars from './AuthorAvatars'import blogAuthors from '@/lib/authors.json'import type PostTypes from '@/types/post'@@ -35,28 +35,14 @@ const BlogListItem = ({ post }: Props) => {<Linkhref={post.path}prefetch={false}- className="group flex flex-col lg:grid lg:grid-cols-10 xl:grid-cols-12 w-full py-2 sm:py-4 h-full border-b"+ className="group flex flex-col lg:grid lg:grid-cols-10 xl:grid-cols-12 w-full py-2 sm:py-4 lg:px-2 h-full hover:bg-surface-75/50 transition-colors"><div className="flex w-full lg:col-span-8 xl:col-span-8">- <h3 className="text-foreground text-lg group-hover:underline">{post.title}</h3>+ <h3 className="text-foreground text-sm group-hover:underline">{post.title}</h3></div><div className="lg:col-span-2 xl:col-span-4 flex justify-start items-center lg:grid grid-cols-2 xl:grid-cols-3 gap-2 text-sm">- <div className="hidden lg:flex items-center -space-x-2">- {authors.map((author: any, i: number) => {- if (!author) return null- return (- <div className="relative ring-background w-6 h-6 rounded-full ring-2" key={i}>- {author.author_image_url && (- <Image- src={author.author_image_url}- className="rounded-full object-cover border border-default w-full h-full"- alt={`${author.author} avatar`}- fill- />- )}- </div>- )- })}+ <div className="hidden lg:block">+ <AuthorAvatars authors={authors} showName={false} size="md" /></div>{post.categories && (<div className="hidden xl:flex text-foreground-lighter group-hover:text-foreground-light">@@ -72,6 +58,7 @@ const BlogListItem = ({ post }: Props) => {)}{post.date && (<p className="text-foreground-lighter group-hover:text-foreground-light flex-1 lg:text-right w-full">+ <span className="sr-only">Published </span>{dayjs(post.date).format('D MMM YYYY')}</p>)}diff --git a/apps/www/components/Blog/BlogListingClient.tsx b/apps/www/components/Blog/BlogListingClient.tsxnew file mode 100644index 00000000000..163ec51dddf--- /dev/null+++ b/apps/www/components/Blog/BlogListingClient.tsx@@ -0,0 +1,110 @@+'use client'++import { type BlogView } from 'app/blog/blog-view'+import BlogGridItem from 'components/Blog/BlogGridItem'+import BlogListItem from 'components/Blog/BlogListItem'+import BlogViewToggle from 'components/Blog/BlogViewToggle'+import { Search } from 'lucide-react'+import { useMemo, useState } from 'react'+import type PostTypes from 'types/post'+import { InputGroup, InputGroupAddon, InputGroupInput } from 'ui'++import SectionContainerWithCn from '@/components/Layouts/SectionContainerWithCn'++interface Props {+ posts: PostTypes[]+ initialView: BlogView+ /**+ * When provided the component operates in controlled mode: the caller owns+ * the view and search state and the built-in filter bar is not rendered.+ */+ view?: BlogView+ searchTerm?: string+}++export default function BlogListingClient({+ posts,+ initialView,+ view: viewProp,+ searchTerm: searchTermProp,+}: Props) {+ const isControlled = viewProp !== undefined++ const [internalView, setInternalView] = useState<BlogView>(initialView)+ const [internalSearchTerm, setInternalSearchTerm] = useState('')++ const view = isControlled ? viewProp : internalView+ const searchTerm = isControlled ? (searchTermProp ?? '') : internalSearchTerm+ const isList = view === 'list'++ const visiblePosts = useMemo(() => {+ if (!searchTerm) return posts+ const term = searchTerm.toLowerCase()+ return posts.filter(+ (post) =>+ (post.title ?? '').toLowerCase().includes(term) ||+ (post.description ?? '').toLowerCase().includes(term) ||+ (post.author ?? '').toLowerCase().includes(term)+ )+ }, [posts, searchTerm])++ return (+ <>+ {!isControlled && (+ <div className="border-default border-t">+ <SectionContainerWithCn height="none" className="py-6">+ <div className="flex flex-row items-center justify-between gap-2">+ <div className="flex-1 max-w-[280px]">+ <InputGroup className="w-full">+ <InputGroupInput+ size="small"+ autoComplete="off"+ type="search"+ placeholder="Search posts"+ value={internalSearchTerm}+ onChange={(e) => setInternalSearchTerm(e.target.value)}+ />+ <InputGroupAddon>+ <Search />+ </InputGroupAddon>+ </InputGroup>+ </div>+ <BlogViewToggle view={internalView} setView={setInternalView} />+ </div>+ </SectionContainerWithCn>+ </div>+ )}++ <SectionContainerWithCn height="none">+ {visiblePosts.length > 0 ? (+ isList ? (+ <ul aria-label={`Blog posts, ${visiblePosts.length} total`}>+ {visiblePosts.map((post, idx) => (+ <li key={`list-${idx}-${post.slug}`}>+ <BlogListItem post={post} />+ </li>+ ))}+ </ul>+ ) : (+ <ul+ aria-label={`Blog posts, ${visiblePosts.length} total`}+ className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 lg:gap-12 py-4"+ >+ {visiblePosts.map((post, idx) => (+ <li key={`grid-${idx}-${post.slug}`}>+ <BlogGridItem post={post} />+ </li>+ ))}+ </ul>+ )+ ) : (+ <div className="px-6 py-12">+ <p className="text-sm text-light">+ {searchTerm ? 'No posts matching your search.' : 'No posts found.'}+ </p>+ </div>+ )}+ </SectionContainerWithCn>+ </>+ )+}diff --git a/apps/www/components/Blog/BlogPostRenderer.tsx b/apps/www/components/Blog/BlogPostRenderer.tsxindex afb3374010c..b01b9d63d73 100644--- a/apps/www/components/Blog/BlogPostRenderer.tsx+++ b/apps/www/components/Blog/BlogPostRenderer.tsx@@ -1,15 +1,14 @@import dayjs from 'dayjs'-import { ChevronLeft } from 'lucide-react'import Image from 'next/image'import Link from 'next/link'-import ReactMarkdown from 'react-markdown'import type { PostReturnType, ProcessedBlogData, StaticAuthor, Tag } from 'types/post'-import { Badge } from 'ui'+import { Badge, cn } from 'ui'+import { CTASection } from '../CTASection'import SectionContainerWithCn from '../Layouts/SectionContainerWithCn'+import { BlogTableOfContents } from '@/components/Blog/BlogTableOfContents'import DraftModeBanner from '@/components/Blog/DraftModeBanner'import ShareArticleActions from '@/components/Blog/ShareArticleActions'-import CTABanner from '@/components/CTABanner'import BlogLinks from '@/components/LaunchWeek/7/BlogLinks'import LW11Summary from '@/components/LaunchWeek/11/LW11Summary'import LW12Summary from '@/components/LaunchWeek/12/LWSummary'@@ -17,8 +16,7 @@ import LW13Summary from '@/components/LaunchWeek/13/Releases/LWSummary'import LW14Summary from '@/components/LaunchWeek/14/Releases/LWSummary'import LW15Summary from '@/components/LaunchWeek/15/LWSummary'import LWXSummary from '@/components/LaunchWeek/X/LWXSummary'-import DefaultLayout from '@/components/Layouts/Default'-import { BLOG_POST_HERO_IMAGE_SIZES, getBlogThumbnailImage } from '@/lib/blog-images'+import { getBlogThumbnailImage } from '@/lib/blog-images'import { compileBlogMdx } from '@/lib/mdx/compileBlogMdx'import mdxComponents from '@/lib/mdx/mdxComponents'@@ -81,103 +79,129 @@ const BlogPostRenderer = async ({const isLaunchWeek14 = blogMetaData.launchweek?.toString().toLocaleLowerCase() === '14'const isLaunchWeek15 = blogMetaData.launchweek?.toString().toLocaleLowerCase() === '15'- const toc = blogMetaData.toc && (- <div>- <p className="text-foreground mb-4">On this page</p>- <div className="prose-toc">- {blogMetaData.toc && (- <ReactMarkdown>- {typeof blogMetaData.toc === 'string'- ? (blogMetaData.toc as string)- : (blogMetaData.toc as { content: string }).content}- </ReactMarkdown>- )}- </div>- </div>- )+ type TocJsonItem = { content: string; slug: string; lvl: number }++ const rawToc = blogMetaData.toc as unknown as { json?: TocJsonItem[] } | string | undefined+ const tocItems =+ rawToc && typeof rawToc !== 'string' && Array.isArray(rawToc.json)+ ? rawToc.json.map((h) => ({ title: h.content, url: `#${h.slug}`, depth: h.lvl }))+ : []+ const toc = tocItems.length > 0 ? <BlogTableOfContents items={tocItems} /> : nullconst imageUrl = getBlogThumbnailImage(blogMetaData, {fallbackToPlaceholder: false,})+ const MARGIN_BOTTOM_CN = 'mb-12'+return (<>{isDraftMode && <DraftModeBanner />}- <DefaultLayout className="overflow-x-hidden">- <SectionContainerWithCn height="narrow">- <div className="grid grid-cols-12 gap-4">- <div className="hidden col-span-12 xl:block lg:col-span-2">- {/* Back button */}- <Link- href="/blog"- className="text-foreground-lighter hover:text-foreground flex cursor-pointer items-center text-sm transition"- >- <ChevronLeft style={{ padding: 0 }} />- Back- </Link>- </div>- <div className="col-span-12 lg:col-span-12 xl:col-span-10">- {/* Title and description */}- <div className="mb-6 lg:mb-10 max-w-5xl space-y-8">- <div className="space-y-4">- <Link href="/blog" className="text-brand hidden lg:inline-flex items-center">+ <div className="overflow-x-clip">+ <SectionContainerWithCn height="none">+ {/*+ * Outer grid: back button | main container+ *+ * base/md : [back:1–12] stacked above [main:1–12]+ * lg : [back:1–12] stacked above [main:2–12]+ * xl : [back:1–2] alongside [main:3–12]+ */}+ <div className="flex justify-center lg:grid grid-cols-12 gap-x-8">+ {/* Main container — indented 1 col at lg, alongside back button at xl */}+ <div className="max-w-[65ch] lg:max-w-none col-span-12 lg:col-start-2 lg:col-span-10 xl:col-start-2 xl:col-span-11">+ {/* Article header — spans the full main container width */}+ <div className="py-8 md:py-12 space-y-4">+ <div className="flex items-center gap-1.5 text-foreground-lighter text-sm">+ <Link+ href="/blog"+ className="hover:text-foreground inline-flex items-center transition"+ >Blog</Link>- <h1 className="text-2xl sm:text-4xl">{blogMetaData.title}</h1>- <div className="text-light flex space-x-3 text-sm">- <p>{dayjs(blogMetaData.date).format('DD MMM YYYY')}</p>+ {blogMetaData.categories && (+ <>+ <span className="text-foreground-muted"> / </span>+ <Link+ href={`/blog/categories/${blogMetaData.categories[0]}`}+ className="capitalize hover:text-foreground"+ >+ {blogMetaData.categories[0]}+ </Link>+ </>+ )}+ </div>+ <h1 className="text-2xl sm:text-3xl lg:text-4xl max-w-3xl text-pretty">+ {blogMetaData.title}+ </h1>+ <div className="flex items-center gap-2">+ <div className="text-foreground-lighter flex space-x-3 text-sm">+ <p>{dayjs(blogMetaData.date).format('D MMM YYYY')}</p><p>·</p><p>{(blogMetaData as any).readingTime}</p></div>- {authors.length > 0 && (- <div className="flex justify-between">- <div className="flex-1 flex flex-wrap gap-3 pt-2 md:gap-0 lg:gap-3">- {authors.map((author, i: number) => {- const authorImageUrl = author.author_image_url-- const authorId =- (author as any).author_id ||- (author as any).username ||- author.author.toLowerCase().replace(/\s+/g, '_')-- return (- <div className="mr-4 w-max" key={`author-${i}-${author.author}`}>- <Link href={`/blog/authors/${authorId}`} className="cursor-pointer">- <div className="flex items-center gap-3">- {authorImageUrl && (- <div className="w-10">- <Image- src={authorImageUrl}- className="border-default rounded-full border w-full max-h-10 aspect-square object-cover"- alt={`${author.author} avatar`}- width={40}- height={40}- />- </div>- )}- <div className="flex flex-col">- <span className="text-foreground mb-0 text-sm">- {author.author}- </span>- <span className="text-foreground-lighter mb-0 text-xs">- {author.position}- </span>- </div>- </div>- </Link>+ </div>+ {authors.length > 0 && (+ <div className="flex flex-row flex-wrap items-center gap-y-4 gap-x-6 md:gap-x-8 mt-6">+ {authors.map((author, i: number) => {+ const authorImageUrl = author.author_image_url+ const authorId =+ (author as any).author_id ||+ (author as any).username ||+ author.author.toLowerCase().replace(/\s+/g, '_')+ return (+ <Link+ href={`/blog/authors/${authorId}`}+ className="cursor-pointer"+ key={`author-${i}-${author.author}`}+ >+ <div className="flex items-center gap-2">+ {authorImageUrl && (+ <Image+ src={authorImageUrl}+ className="w-5 h-5 md:w-8 md:h-8 border-default rounded-full border aspect-square object-cover"+ alt={`${author.author} avatar`}+ width={32}+ height={32}+ />+ )}+ <div className="flex flex-col">+ <span className="text-foreground text-sm">{author.author}</span>+ <span className="text-foreground-lighter text-xs hidden md:inline-block">+ {author.position}+ </span></div>- )- })}- </div>+ </div>+ </Link>+ )+ })}+ </div>+ )}+ </div>++ {/*+ * Inner grid: article body | sidebar+ *+ * base/md : single column, sidebar hidden+ * lg+ : [body:7fr] [sidebar:3fr]+ */}+ <div className="lg:grid lg:grid-cols-12 lg:gap-x-8 xl:gap-x-12">+ {/* Article body */}+ <div className={cn('col-span-8', MARGIN_BOTTOM_CN)}>+ {!blogMetaData.youtubeHero && blogMetaData.imgThumb && imageUrl && (+ <div className="hidden lg:block relative w-full aspect-[1.91/1] overflow-hidden rounded-lg border border-foreground/10 mb-6">+ <Image+ src={imageUrl}+ alt={blogMetaData.title}+ fill+ quality={100}+ sizes="(max-width: 768px) 100vw, 58vw"+ className="object-cover"+ /></div>)}- </div>- </div>- <div className="grid grid-cols-12 lg:gap-16 xl:gap-8">- {/* Content */}- <div className="col-span-12 lg:col-span-7 xl:col-span-7">+<article>- <div className={['prose prose-docs'].join(' ')}>+ <div className="prose prose-docs">{blogMetaData.youtubeHero ? (<iframetitle="YouTube video player"@@ -188,22 +212,11 @@ const BlogPostRenderer = async ({allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"allowFullScreen={true}/>- ) : (- imageUrl && (- <div className="hidden md:block relative mb-8 w-full aspect-[1.91/1] overflow-auto rounded-lg border">- <Image- src={imageUrl}- alt={blogMetaData.title}- fill- sizes={BLOG_POST_HERO_IMAGE_SIZES}- className="object-cover m-0"- />- </div>- )- )}+ ) : null}{mdxRendered}</div></article>+{isLaunchWeek7 && <BlogLinks />}{isLaunchWeekX && <LWXSummary />}{isGAWeek && <LW11Summary />}@@ -211,11 +224,12 @@ const BlogPostRenderer = async ({{isLaunchWeek13 && <LW13Summary />}{isLaunchWeek14 && <LW14Summary />}{isLaunchWeek15 && <LW15Summary />}+<div className="block lg:hidden py-8">- <div className="text-foreground-lighter text-sm">Share this article</div><ShareArticleActions title={blogMetaData.title} slug={blogMetaData.slug} /></div>- <div className="grid gap-8 py-8 lg:grid-cols-1">++ <div className="grid gap-8 mt-8 lg:grid-cols-1"><div>{prevPost && (<NextCard@@ -247,25 +261,37 @@ const BlogPostRenderer = async ({</div></div></div>- {/* Sidebar */}- <div className="relative col-span-12 space-y-8 lg:col-span-5 xl:col-span-3 xl:col-start-9">- <div className="space-y-6">- <div className="hidden lg:block">- <div className="flex flex-wrap gap-2">- {(blogMetaData.tags as Array<Tag>)?.map((tag) => {- const tagName = typeof tag === 'string' ? tag : tag.name- const tagId = typeof tag === 'string' ? tag : tag.id.toString()- return (- <Link href={`/blog/tags/${tagName}`} key={`category-badge-${tagId}`}>- <Badge>{tagName}</Badge>- </Link>- )- })}- </div>++ {/* Sidebar — only above lg */}+ <div+ className={cn(+ 'hidden lg:block col-span-4 col-start-9 space-y-8 lg:pl-6',+ MARGIN_BOTTOM_CN+ )}+ >+ {(blogMetaData.tags as Tag[])?.length > 0 && (+ <div className="flex flex-wrap items-center gap-2">+ {(blogMetaData.tags as Tag[])?.map((tag) => {+ const tagName = typeof tag === 'string' ? tag : tag.name+ const tagId = typeof tag === 'string' ? tag : tag.id.toString()+ return (+ <Link+ className="flex"+ href={`/blog/tags/${tagName}`}+ key={`category-badge-${tagId}`}+ >+ <Badge>{tagName}</Badge>+ </Link>+ )+ })}</div>- <div className="hidden lg:block">{toc}</div>- <div className="hidden lg:block">- <div className="text-foreground text-sm">Share this article</div>+ )}+ <div className="sticky top-24 flex flex-col gap-6 max-h-[calc(100vh-7rem)]">+ <p className="text-foreground font-mono uppercase tracking-wide text-xs -mb-2">+ On this page+ </p>+ <div className="overflow-y-auto min-h-0 flex-1">{toc}</div>+ <div className="shrink-0"><ShareArticleActions title={blogMetaData.title} slug={blogMetaData.slug} /></div></div>@@ -275,8 +301,10 @@ const BlogPostRenderer = async ({</div></SectionContainerWithCn>- <CTABanner />- </DefaultLayout>+ <div className="border-t">+ <CTASection />+ </div>+ </div></>)}diff --git a/apps/www/components/Blog/BlogTableOfContents.tsx b/apps/www/components/Blog/BlogTableOfContents.tsxnew file mode 100644index 00000000000..9e165c4cd6a--- /dev/null+++ b/apps/www/components/Blog/BlogTableOfContents.tsx@@ -0,0 +1,60 @@+'use client'++import { useEffect, useState, type ReactNode } from 'react'+import { AnchorProvider, Toc, TOCItems, TocPrimitive, TOCScrollArea } from 'ui-patterns/Toc'+import type { TOCItemType } from 'ui-patterns/Toc/types'++interface Props {+ items: TOCItemType[]+}++function SuppressUntilFirstAnchor({+ items,+ children,+}: {+ items: TOCItemType[]+ children: ReactNode+}) {+ const [enabled, setEnabled] = useState(false)+ const anchors = TocPrimitive.useActiveAnchors()++ useEffect(() => {+ const firstId = items[0]?.url.split('#')[1]+ if (!firstId) return++ const el = document.getElementById(firstId)+ if (!el) return++ // Activate when the first heading is within the bottom half of the viewport,+ // anticipating navigation jumps that land the heading near the top+ const check = () => setEnabled(el.getBoundingClientRect().top <= window.innerHeight * 0.5)++ check()+ window.addEventListener('scroll', check, { passive: true })+ return () => window.removeEventListener('scroll', check)+ }, [items])++ return (+ <TocPrimitive.ActiveAnchorContext.Provider value={enabled ? anchors : []}>+ {children}+ </TocPrimitive.ActiveAnchorContext.Provider>+ )+}++export function BlogTableOfContents({ items }: Props) {+ if (!items.length) return null++ return (+ <AnchorProvider toc={items} single>+ <SuppressUntilFirstAnchor items={items}>+ <Toc className="border-l">+ <TOCScrollArea className="ml-[-2px]">+ <div className="-ml-3">+ <TOCItems items={items} />+ </div>+ </TOCScrollArea>+ </Toc>+ </SuppressUntilFirstAnchor>+ </AnchorProvider>+ )+}diff --git a/apps/www/components/Blog/BlogViewToggle.tsx b/apps/www/components/Blog/BlogViewToggle.tsxnew file mode 100644index 00000000000..9459d603614--- /dev/null+++ b/apps/www/components/Blog/BlogViewToggle.tsx@@ -0,0 +1,49 @@+'use client'++import { setBlogViewCookie, type BlogView } from 'app/blog/blog-view'+import { motion } from 'framer-motion'+import { AlignJustify, Grid } from 'lucide-react'+import { cn } from 'ui'++export default function BlogViewToggle({+ view,+ setView,+}: {+ view: BlogView+ setView: (view: BlogView) => void+}) {+ return (+ <div className="flex items-center border border-border rounded-md p-0.5 gap-0.5 bg-surface-100">+ {(['list', 'grid'] as BlogView[]).map((v) => (+ <button+ key={v}+ onClick={() => {+ setView(v)+ setBlogViewCookie(v)+ }}+ aria-label={`${v} view`}+ aria-pressed={view === v}+ className={cn(+ 'relative flex items-center justify-center w-7 h-7 rounded-sm transition-colors',+ view === v ? 'text-foreground' : 'text-foreground-light hover:text-foreground'+ )}+ >+ {view === v && (+ <motion.span+ layoutId="blog-view-bg"+ className="absolute inset-0 rounded-sm bg-surface-300 border border-border"+ transition={{ type: 'spring', duration: 0.3, bounce: 0.15 }}+ />+ )}+ <span className="relative z-10">+ {v === 'list' ? (+ <AlignJustify className="w-3.5 h-3.5" />+ ) : (+ <Grid className="w-3.5 h-3.5" />+ )}+ </span>+ </button>+ ))}+ </div>+ )+}diff --git a/apps/www/components/Blog/FeaturedThumb.tsx b/apps/www/components/Blog/FeaturedThumb.tsxindex 4e72a00f1db..fdf89004cc0 100644--- a/apps/www/components/Blog/FeaturedThumb.tsx+++ b/apps/www/components/Blog/FeaturedThumb.tsx@@ -1,6 +1,7 @@import Image from 'next/image'import Link from 'next/link'+import AuthorAvatars from './AuthorAvatars'import authors from '@/lib/authors.json'import {BLOG_FEATURED_IMAGE_SIZES,@@ -10,7 +11,6 @@ import {import type PostTypes from '@/types/post'function FeaturedThumb(blog: PostTypes) {- // For static posts, look up author info from authors.jsonconst authorArray = blog.author?.split(',').map((a) => a.trim()) || []const author = []@@ -30,66 +30,52 @@ function renderFeaturedThumb(blog: PostTypes, author: any[]) {const imageUrl = getBlogThumbnailImage(blog) ?? BLOG_PLACEHOLDER_IMAGEreturn (- <div key={blog.slug} className="w-full">+ <article aria-label={`Featured post: ${blog.title}`}><Linkhref={`${blog.path}`}- className="grid gap-4 lg:grid-cols-7 lg:gap-8 xl:gap-12 hover:bg-surface-200 dark:hover:bg-surface-75 p-2 sm:p-4 rounded-xl"+ prefetch={false}+ key={blog.slug}+ className="group w-full grid lg:grid-cols-12 gap-8 md:gap-12 hover:bg-surface-200 dark:hover:bg-surface-75 p-2 sm:p-4 rounded-xl">- <div className="relative w-full aspect-2/1 lg:col-span-3 lg:aspect-3/2 overflow-auto rounded-lg border">- <Image- src={imageUrl}- fill- sizes={BLOG_FEATURED_IMAGE_SIZES}- priority- className="object-cover bg-alternative"- alt="blog thumbnail"- />- </div>- <div className="flex flex-col space-y-2 lg:col-span-4 xl:justify-center max-w-xl">- <div className="text-lighter flex space-x-2 text-sm">- <span>{blog.formattedDate}</span>- <span>·</span>- <span>{blog.readingTime}</span>+ <div className="relative w-full aspect-[1.91/1] lg:col-span-6 overflow-hidden block group">+ <div className="relative w-full h-full shadow-lg border border-foreground/10 rounded-lg overflow-hidden">+ <Image+ src={imageUrl}+ fill+ sizes={BLOG_FEATURED_IMAGE_SIZES}+ priority+ className="object-cover bg-alternative group-hover:scale-[1.02] transition-transform duration-300"+ alt=""+ /></div>+ </div>+ {/* Text */}+ <div className="flex flex-col lg:col-span-6 md:justify-center"><div>- <h2 className="h2 lg:text-2xl! xl:text-3xl! mb-2!">{blog.title}</h2>- <p className="p xl:text-lg">{blog.description}</p>+ <h2 className="h2 lg:text-2xl! xl:text-3xl! mb-2! group-hover:underline">+ {blog.title}+ </h2>+ <p className="p">{blog.description}</p></div>- <div className="flex flex-col w-max gap-2">- {author.filter(Boolean).map((author: any, i: number) => {- const authorImageUrl =- typeof author.author_image_url === 'string'- ? author.author_image_url- : (author.author_image_url as { url: string })?.url || ''-- return (- <div- className="flex items-center space-x-2"- key={`author-feat-${i}-${author.author}`}- >- {imageUrl && (- <div className="relative h-6 w-6 overflow-auto">- <Image- src={authorImageUrl}- alt={`${author.author} avatar`}- className="rounded-full object-cover"- fill- sizes="30px"- />- </div>- )}- <div className="flex flex-col">- <span className="text-foreground m-0 text-sm">{author.author}</span>- </div>- </div>- )- })}+ <div className="flex items-center justify-between mt-4">+ <div>+ <span className="sr-only">Author: </span>+ <AuthorAvatars authors={author} size="md" />+ </div>+ <div className="text-foreground-lighter flex space-x-2 text-sm">+ <span>+ <span className="sr-only">Published </span>+ {blog.formattedDate}+ </span>+ <span aria-hidden="true">·</span>+ <span>{blog.readingTime}</span>+ </div></div></div></Link>- </div>+ </article>)}diff --git a/apps/www/components/Blog/ShareArticleActions.tsx b/apps/www/components/Blog/ShareArticleActions.tsxindex 284080999bb..8360f2abfad 100644--- a/apps/www/components/Blog/ShareArticleActions.tsx+++ b/apps/www/components/Blog/ShareArticleActions.tsx@@ -1,10 +1,24 @@+'use client'++import { useCopyMarkdownFromUrl } from 'common'import Link from 'next/link'-import { cn, IconLinkedinSolid, IconTwitterX, IconYCombinator } from 'ui'+import {+ cn,+ IconLinkedinSolid,+ IconTwitterX,+ IconYCombinator,+ Tooltip,+ TooltipContent,+ TooltipProvider,+ TooltipTrigger,+} from 'ui'++import { SITE_ORIGIN } from '@/lib/constants'const ShareArticleActions = ({title,slug,- iconSize = 20,+ iconSize = 16,basePath = 'https://supabase.com/blog/',className,}: {@@ -14,37 +28,60 @@ const ShareArticleActions = ({basePath?: stringclassName?: string}) => {+ const { copied, copyMarkdown } = useCopyMarkdownFromUrl()+const permalink = encodeURIComponent(`${basePath}${slug}`)const encodedTitle = encodeURIComponent(title)+ const mdPath = `/blog/${slug}.md`+ const mdAbs = `${SITE_ORIGIN}${mdPath}`+ const aiPrompt = `Read from ${mdAbs} so I can ask questions about its contents`return (- <div className={cn('mt-4 flex items-center gap-4', className)}>- <Link- aria-label="Share on X"- href={`https://twitter.com/intent/tweet?url=${permalink}&text=${encodedTitle}`}- target="_blank"- className="text-foreground-lighter hover:text-foreground"- >- <IconTwitterX size={iconSize} />- </Link>-- <Link- aria-label="Share on Linkedin"- href={`https://www.linkedin.com/shareArticle?url=${permalink}&text=${encodedTitle}`}- target="_blank"- className="text-foreground-lighter hover:text-foreground"- >- <IconLinkedinSolid size={iconSize} />- </Link>- <Link- aria-label="Share on Hacker News"- href={`https://news.ycombinator.com/submitlink?u=${permalink}&t=${encodedTitle}`}- target="_blank"- className="text-foreground-lighter hover:text-foreground"- >- <IconYCombinator size={iconSize} />- </Link>- </div>+ <TooltipProvider>+ <div className={cn('mt-4 flex items-center gap-4', className)}>+ <Tooltip>+ <TooltipTrigger asChild>+ <Link+ aria-label="Share on X"+ href={`https://twitter.com/intent/tweet?url=${permalink}&text=${encodedTitle}`}+ target="_blank"+ className="text-foreground-lighter hover:text-foreground transition-colors"+ >+ <IconTwitterX size={iconSize} />+ </Link>+ </TooltipTrigger>+ <TooltipContent sideOffset={8}>Share on X</TooltipContent>+ </Tooltip>++ <Tooltip>+ <TooltipTrigger asChild>+ <Link+ aria-label="Share on LinkedIn"+ href={`https://www.linkedin.com/shareArticle?url=${permalink}&text=${encodedTitle}`}+ target="_blank"+ className="text-foreground-lighter hover:text-foreground transition-colors"+ >+ <IconLinkedinSolid size={iconSize} />+ </Link>+ </TooltipTrigger>+ <TooltipContent sideOffset={8}>Share on LinkedIn</TooltipContent>+ </Tooltip>++ <Tooltip>+ <TooltipTrigger asChild>+ <Link+ aria-label="Share on Hacker News"+ href={`https://news.ycombinator.com/submitlink?u=${permalink}&t=${encodedTitle}`}+ target="_blank"+ className="text-foreground-lighter hover:text-foreground transition-colors"+ >+ <IconYCombinator size={iconSize} />+ </Link>+ </TooltipTrigger>+ <TooltipContent sideOffset={8}>Share on Hacker News</TooltipContent>+ </Tooltip>+ </div>+ </TooltipProvider>)}diff --git a/apps/www/components/Layouts/Default.tsx b/apps/www/components/Layouts/Default.tsxindex fb71f6f5f37..60e204116ba 100644--- a/apps/www/components/Layouts/Default.tsx+++ b/apps/www/components/Layouts/Default.tsx@@ -1,10 +1,9 @@-'use client'--import Footer from 'components/Footer/index'-import Nav from 'components/Nav/index'-import { useForceDeepDark } from 'lib/theme.utils'import { cn } from 'ui'+import Footer from '@/components/Footer/index'+import Nav from '@/components/Nav/index'+import { ThemeForcer } from '@/components/ThemeForcer'+type Props = {hideHeader?: booleanhideFooter?: boolean@@ -24,10 +23,9 @@ const DefaultLayout = (props: Props) => {children,} = props- useForceDeepDark()-return (<>+ <ThemeForcer /><Nav hideNavbar={hideHeader} stickyNavbar={stickyNavbar} /><main className={cn('relative min-h-screen', className)}>{children}</main><Footer className={footerClassName} hideFooter={hideFooter} />diff --git a/apps/www/components/ScrollProgress.tsx b/apps/www/components/ScrollProgress.tsxindex 9c1f5fcaba6..99ec261d1c2 100644--- a/apps/www/components/ScrollProgress.tsx+++ b/apps/www/components/ScrollProgress.tsx@@ -7,8 +7,7 @@ const ScrollProgress = () => {const [progressPercentage, setProgressPercentage] = useState(0)const pathname = usePathname()- const isBlogPost = pathname?.includes('/blog/')- if (!isBlogPost) return null+ const isBlogPost = /^\/blog\/[^/]+\/?$/.test(pathname ?? '')const handleScroll = () => {if (typeof document === 'undefined') return null@@ -22,11 +21,14 @@ const ScrollProgress = () => {}useEffect(() => {+ if (!isBlogPost) returnwindow.addEventListener('scroll', handleScroll)return () => {window.removeEventListener('scroll', handleScroll)}- }, [])+ }, [isBlogPost])++ if (!isBlogPost) return nulllet isActive = progressPercentage <= 100diff --git a/apps/www/components/ThemeForcer.tsx b/apps/www/components/ThemeForcer.tsxnew file mode 100644index 00000000000..51679284972--- /dev/null+++ b/apps/www/components/ThemeForcer.tsx@@ -0,0 +1,8 @@+'use client'++import { useForceDeepDark } from 'lib/theme.utils'++export function ThemeForcer() {+ useForceDeepDark()+ return null+}diff --git a/apps/www/styles/globals.css b/apps/www/styles/globals.cssindex 81857aa2199..1d85888eeb8 100644--- a/apps/www/styles/globals.css+++ b/apps/www/styles/globals.css@@ -371,28 +371,7 @@ table {}.next-image--dynamic-fill.wide,video.wide {- @apply sm:my-0 sm:max-w-none sm:-mx-8 sm:w-[calc(100%+4rem)];-}-@media (min-width: 560px) {- .next-image--dynamic-fill.wide,- video.wide {- width: calc(100% + 6rem) !important;- margin: 0 -3rem;- }-}-@media (min-width: 1280px) {- .next-image--dynamic-fill.wide,- video.wide {- width: calc(100% + 10rem) !important;- margin: 0 -5rem;- }-}-@media (min-width: 1535px) {- .next-image--dynamic-fill.wide,- video.wide {- width: calc(100% + 14rem) !important;- margin: 0 -7rem;- }+ @apply sm:max-w-none -mx-2 w-[calc(100%+1rem)] md:-mx-4 md:w-[calc(100%+2rem)] lg:-mx-8 lg:w-[calc(100%+4rem)];}.next-image--dynamic-fill > span {diff --git a/packages/ui-patterns/src/GlassPanel/index.tsx b/packages/ui-patterns/src/GlassPanel/index.tsxindex afc90571151..11858aeddf0 100644--- a/packages/ui-patterns/src/GlassPanel/index.tsx+++ b/packages/ui-patterns/src/GlassPanel/index.tsx@@ -39,13 +39,15 @@ const IconBackground = ({const LogoComponent = ({logoImage,className,+ wrapperClassName,title,}: {title: stringlogoImage: stringclassName?: string+ wrapperClassName?: string}) => (- <div className="relative box-content p-8 pb-0">+ <div className={cn('relative box-content p-8 pb-0', wrapperClassName)}><div className="relative h-[33px] w-auto max-w-[145px]"><Imagesrc={logoImage}@@ -72,8 +74,6 @@ export const GlassPanel = ({className,}: Props) => {const { resolvedTheme } = useTheme()- const showLogoInverse = logoInverse && resolvedTheme?.includes('dark')- const showLogo = !showLogoInverse && logoreturn (<div@@ -92,10 +92,22 @@ export const GlassPanel = ({className)}>- {showLogoInverse && (- <LogoComponent title={title} logoImage={logoInverse} className="opacity-50" />+ {logoInverse && (+ <LogoComponent+ title={title}+ logoImage={logoInverse}+ className="opacity-50"+ wrapperClassName="hidden dark:block"+ />+ )}+ {logo && (+ <LogoComponent+ title={title}+ logoImage={logo}+ className="opacity-75"+ wrapperClassName={logoInverse ? 'block dark:hidden' : undefined}+ />)}- {showLogo && <LogoComponent title={title} logoImage={logo} className="opacity-75" />}{header && (<img