The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix(www): stop blog tag and author breadcrumbs from becoming the page h1 (#49507)
claude[bot]580af6e336a9
diff --git a/apps/www/app/blog/BlogLayoutShell.tsx b/apps/www/app/blog/BlogLayoutShell.tsxindex 432edf2d661..0d9100704cb 100644--- a/apps/www/app/blog/BlogLayoutShell.tsx+++ b/apps/www/app/blog/BlogLayoutShell.tsx@@ -6,6 +6,11 @@ import type PostTypes from 'types/post'import BlogHero from './BlogHero'import DefaultLayout from '@/components/Layouts/Default'+// Listing routes have no page-specific title of their own, so they share the+// generic screen-reader heading below. Without it the visible breadcrumb ends up+// as the only heading on the page, and search engines pick that up as the title.+const LISTING_ROUTE_PREFIXES = ['/blog/categories/', '/blog/tags/', '/blog/authors/']+export default function BlogLayoutShell({featuredPost,secondaryPosts,@@ -16,7 +21,8 @@ export default function BlogLayoutShell({children: React.ReactNode}) {const pathname = usePathname()- const isListingRoute = pathname === '/blog' || Boolean(pathname?.startsWith('/blog/categories/'))+ const isListingRoute =+ pathname === '/blog' || LISTING_ROUTE_PREFIXES.some((prefix) => pathname?.startsWith(prefix))return (<DefaultLayout>diff --git a/apps/www/app/blog/authors/[author]/AuthorClient.tsx b/apps/www/app/blog/authors/[author]/AuthorClient.tsxindex b382cd6e549..c55b3ddba6e 100644--- a/apps/www/app/blog/authors/[author]/AuthorClient.tsx+++ b/apps/www/app/blog/authors/[author]/AuthorClient.tsx@@ -52,11 +52,14 @@ export default function AuthorClient({ author, authorId, blogs, initialView }: A<><SectionContainerWithCn height="narrow" className="space-y-6"><div className="text-foreground-lighter flex space-x-1">- <h1 className="cursor-pointer">+ <nav+ aria-label="Breadcrumb"+ className="cursor-pointer font-heading font-medium tracking-normal"+ ><Link href="/blog">Blog</Link><span className="px-2">/</span><span className="text-foreground">{author?.author ?? authorId}</span>- </h1>+ </nav></div>{author && (diff --git a/apps/www/app/blog/authors/[author]/page.tsx b/apps/www/app/blog/authors/[author]/page.tsxindex 342be9b46ee..33141c0ea20 100644--- a/apps/www/app/blog/authors/[author]/page.tsx+++ b/apps/www/app/blog/authors/[author]/page.tsx@@ -34,7 +34,7 @@ export async function generateMetadata({return {title: author ? `Blog | ${author.author}` : 'Blog | Author',- description: author ? `Blog posts by ${author.author}` : 'Latest news from the Supabase team.',+ description: author ? `Blog posts by ${author.author}.` : 'Latest news from the Supabase team.',}}diff --git a/apps/www/app/blog/categories/[category]/CategoryClient.tsx b/apps/www/app/blog/categories/[category]/CategoryClient.tsxindex ec4b6237eea..818e1de54f9 100644--- a/apps/www/app/blog/categories/[category]/CategoryClient.tsx+++ b/apps/www/app/blog/categories/[category]/CategoryClient.tsx@@ -11,10 +11,9 @@ import SectionContainer from '@/components/Layouts/SectionContainer'interface Props {posts: PostTypes[]initialView: BlogView- category: string}-export default function CategoryClient({ posts, initialView, category: _category }: Props) {+export default function CategoryClient({ posts, initialView }: Props) {const [view, setView] = useState<BlogView>(initialView)const [searchTerm, setSearchTerm] = useState('')diff --git a/apps/www/app/blog/categories/[category]/page.tsx b/apps/www/app/blog/categories/[category]/page.tsxindex b2fbac3d7d7..40fb5f34db2 100644--- a/apps/www/app/blog/categories/[category]/page.tsx+++ b/apps/www/app/blog/categories/[category]/page.tsx@@ -4,7 +4,7 @@ import { cookies } from 'next/headers'import { notFound } from 'next/navigation'import CategoryClient from './CategoryClient'-import { capitalize } from '@/lib/helpers'+import { startCase } from '@/lib/helpers'import { getAllCategories, getSortedPosts } from '@/lib/posts'import type PostTypes from '@/types/post'@@ -17,10 +17,10 @@ export async function generateMetadata({}): Promise<Metadata> {const params = await paramsPromise- const capitalizedCategory = capitalize(params?.category.replaceAll('-', ' '))+ const categoryLabel = startCase(params?.category.replaceAll('-', ' '))return {- title: `Blog | ${capitalizedCategory}`,- description: 'Latest news from the Supabase team.',+ title: `Blog | ${categoryLabel}`,+ description: `Blog posts in ${categoryLabel}.`,}}@@ -48,16 +48,7 @@ export default async function CategoriesPage({})const blogs = [...staticPosts] as PostTypes[]- 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 (- <CategoryClient- key={params.category}- posts={blogs}- initialView={initialView}- category={capitalizedCategory}- />- )+ return <CategoryClient key={params.category} posts={blogs} initialView={initialView} />}diff --git a/apps/www/app/blog/tags/[tag]/TagClient.tsx b/apps/www/app/blog/tags/[tag]/TagClient.tsxindex a17e1c9da60..a070dd4d296 100644--- a/apps/www/app/blog/tags/[tag]/TagClient.tsx+++ b/apps/www/app/blog/tags/[tag]/TagClient.tsx@@ -18,13 +18,13 @@ export default function TagClient({ posts, initialView, tag }: Props) {<><SectionContainerWithCn height="narrow" className="space-y-6"><div className="text-foreground-lighter flex space-x-1">- <h1>+ <nav aria-label="Breadcrumb" className="font-heading font-medium tracking-normal"><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>+ </nav></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 2b8f30be755..6bd13450ea2 100644--- a/apps/www/app/blog/tags/[tag]/page.tsx+++ b/apps/www/app/blog/tags/[tag]/page.tsx@@ -3,12 +3,16 @@ import type { Metadata } from 'next'import { cookies } from 'next/headers'import TagClient from './TagClient'-import { capitalize } from '@/lib/helpers'+import { startCase } from '@/lib/helpers'import { getAllTags, getSortedPosts } from '@/lib/posts'import type PostTypes from '@/types/post'type Params = { tag: string }+// Shared by the metadata title and the visible breadcrumb so the two never+// disagree. Matches the casing the blog filter chips use.+const toTagLabel = (tag: string) => startCase(tag.replaceAll('-', ' '))+export async function generateStaticParams() {const tags = getAllTags('_blog')return tags.map((tag: string) => ({ tag }))@@ -21,10 +25,10 @@ export async function generateMetadata({}): Promise<Metadata> {const params = await paramsPromise- const capitalizedTag = capitalize(params?.tag.replaceAll('-', ' '))+ const tagLabel = toTagLabel(params.tag)return {- title: `Blog | ${capitalizedTag}`,- description: 'Latest news from the Supabase team.',+ title: `Blog | ${tagLabel}`,+ description: `Blog posts tagged ${tagLabel}.`,}}@@ -37,7 +41,13 @@ export default async function TagPage({ params: paramsPromise }: { params: Promiconst staticPosts = getSortedPosts({ directory: '_blog', limit: 0, tags: [params.tag] })const blogs = [...staticPosts] as PostTypes[]- const capitalizedTag = capitalize(params?.tag.replaceAll('-', ' '))- return <TagClient key={params.tag} posts={blogs} initialView={initialView} tag={capitalizedTag} />+ return (+ <TagClient+ key={params.tag}+ posts={blogs}+ initialView={initialView}+ tag={toTagLabel(params.tag)}+ />+ )}