From 8c5c5d866bd4d8f6a53779c539f84d5173b68c13 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Sat, 12 Sep 2026 15:20:05 +0000 Subject: [PATCH] blog: author is jsonb, render a name not [object Object] The blog_posts.author column is jsonb (e.g. { name, url }), not text. Extract a display name for the byline and JSON-LD instead of rendering the object directly. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01MxNif5tsYq4LczgG7aE8Jp --- apps/logicsrc-web/src/app/blog/[slug]/page.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/logicsrc-web/src/app/blog/[slug]/page.tsx b/apps/logicsrc-web/src/app/blog/[slug]/page.tsx index edac6bc3..16e28584 100644 --- a/apps/logicsrc-web/src/app/blog/[slug]/page.tsx +++ b/apps/logicsrc-web/src/app/blog/[slug]/page.tsx @@ -21,9 +21,18 @@ type PostRow = { // When set, it is the canonical for search engines and is shown to readers, // so a cross-post never competes with its source for the same words. canonical_url: string | null; - author: string | null; + // Stored as jsonb: an object like { name, url }, or occasionally a bare + // string. Never rendered directly, or an object prints as [object Object]. + author: { name?: string; url?: string } | string | null; }; +/** A display name from the jsonb author, whatever shape it took. */ +function authorName(author: PostRow["author"]): string { + if (!author) return ""; + if (typeof author === "string") return author; + return typeof author.name === "string" ? author.name : ""; +} + const SITE_URL = (process.env.PUBLIC_URL ?? "https://logicsrc.com").replace(/\/$/, ""); async function loadPost(slug: string): Promise { @@ -93,9 +102,10 @@ export default async function BlogPostPage({ url: `${SITE_URL}/blog/${post.slug}`, // For a guest post this is the original; search engines follow it. mainEntityOfPage: canonical, - ...(post.author ? { author: { "@type": "Person", name: post.author } } : {}), + ...(authorName(post.author) ? { author: { "@type": "Person", name: authorName(post.author) } } : {}), publisher: { "@id": `${SITE_URL}/#organization` }, }; + const byline = authorName(post.author); let originHost = ""; if (post.canonical_url) { try { @@ -123,7 +133,7 @@ export default async function BlogPostPage({
{formatDate(post.published_at)} - {post.author ? ` · ${post.author}` : ""} + {byline ? ` · ${byline}` : ""} {post.canonical_url ? ( <> {" · "}