The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: multiple authors on blog
Isaiah Hamilton76647b06eb6a
diff --git a/www/components/Blog/BlogListItem.tsx b/www/components/Blog/BlogListItem.tsxindex d7d1e560454..bf1ad4b84f7 100644--- a/www/components/Blog/BlogListItem.tsx+++ b/www/components/Blog/BlogListItem.tsx@@ -1,4 +1,3 @@-import { Space } from '@supabase/ui'import authors from 'lib/authors.json'import React from 'react'import Image from 'next/image'@@ -10,7 +9,18 @@ interface Props {const BlogListItem = ({ post }: Props) => {// @ts-ignore- const author = post.author ? authors[post.author] : authors['supabase']+ const authorArray = blog.author.split(',')++ const author = []+ for (let i = 0; i < authorArray.length; i++) {+ author.push(+ // @ts-ignore+ authors.find((authors: string) => {+ // @ts-ignore+ return authors.author_id === authorArray[i]+ })+ )+ }return (<div key={post.slug}>@@ -39,17 +49,19 @@ const BlogListItem = ({ post }: Props) => {{post.date && <p className="text-xs text-scale-1100">{post.date}</p>}<p className="text-base text-scale-1100 max-w-sm">{post.description}</p></div>- {author && !post.hideAuthor ? (- <div className="flex items-center">- {author.author_image_url && (- <img src={author.author_image_url} className="rounded-full w-10 mr-4" />- )}- <div className="flex flex-col">- <span className="text-sm m-0 text-scale-1200">{author.author}</span>- <span className="text-xs m-0 text-scale-900">{author.position}</span>+ {author.map((author: any) => {+ return (+ <div className="flex items-center">+ {author.author_image_url && (+ <img src={author.author_image_url} className="rounded-full w-10 mr-4" />+ )}+ <div className="flex flex-col">+ <span className="text-sm m-0 text-scale-1200">{author.author}</span>+ <span className="text-xs m-0 text-scale-900">{author.position}</span>+ </div></div>- </div>- ) : null}+ )+ })}</div></div></a>diff --git a/www/lib/authors.json b/www/lib/authors.jsonindex 64d7d97e781..edaa5a794da 100644--- a/www/lib/authors.json+++ b/www/lib/authors.json@@ -1,101 +1,116 @@-{- "rory_wilding": {- "author": "Rory Wilding",- "author_url": "https://github.com/roryw10",- "author_image_url": "https://github.com/roryw10.png",- "position": "Head of Growth"+[+ {+ "author_id": "angelico_de_los_reyes",+ "author": "Angelico de los Reyes",+ "position": "",+ "author_url": "https://github.com/dragarcia",+ "author_image_url": "https://github.com/dragarcia.png"},- "ant_wilson": {+ {+ "author_id": "ant_wilson","author": "Ant Wilson",+ "position": "CTO and Co-Founder","author_url": "https://github.com/awalias",- "author_image_url": "https://github.com/awalias.png",- "position": "CTO and Co-Founder"+ "author_image_url": "https://github.com/awalias.png"},- "paul_copplestone": {- "author": "Paul Copplestone",- "author_url": "https://github.com/kiwicopple",- "author_image_url": "https://github.com/kiwicopple.png",- "position": "CEO and Co-Founder"+ {+ "author_id": "soedirgo",+ "author": "Bobbie Soedirgo",+ "username": "soedirgo",+ "position": "Engineering",+ "author_url": "https://github.com/soedirgo",+ "author_image_url": "https://github.com/soedirgo.png"},- "angelico_de_los_reyes": {- "author": "Angelico de los Reyes",- "author_url": "https://github.com/dragarcia",- "author_image_url": "https://avatars0.githubusercontent.com/u/26374889?s=400&u=f5e35e9b47a50fa2b4d8c4bb96babd921071bcf1&v=4",- "position": ""+ {+ "author_id": "div_arora",+ "author": "Div Arora",+ "username": "darora",+ "position": "Engineering",+ "author_url": "https://github.com/darora",+ "author_image_url": "https://github.com/darora.png"},- "thor_schaeff": {- "author": "Thor Schaeff",- "author_url": "https://github.com/thorwebdev",- "author_image_url": "https://github.com/thorwebdev.png",- "position": "DevRel & DX"+ {+ "author_id": "fracek",+ "author": "Francesco Ceccon",+ "username": "fracek",+ "position": "Engineering",+ "author_url": "https://github.com/fracek",+ "author_image_url": "https://github.com/fracek.png"},- "supabase": {- "author": "Supabase",- "author_url": "https://github.com/supabase",- "author_image_url": "https://github.com/supabase.png",- "position": ""+ {+ "author_id": "gurjeet",+ "author": "Gurjeet Singh",+ "username": "gurjeet",+ "position": "Engineering",+ "author_url": "https://github.com/gurjeet",+ "author_image_url": "https://github.com/gurjeet.png"},- "inian": {+ {+ "author_id": "inian","author": "Inian Parameshwaran",- "author_url": "https://twitter.com/everConfusedGuy",- "position": "Engineering","username": "inian",+ "position": "Engineering",+ "author_url": "https://twitter.com/everConfusedGuy","author_image_url": "https://avatars.githubusercontent.com/u/2155545?v=4"},- "soedirgo": {- "author": "Bobbie Soedirgo",- "author_url": "https://github.com/soedirgo",+ {+ "author_id": "kangmingtay",+ "author": "Kang Ming Tay",+ "username": "kangmingtay","position": "Engineering",- "username": "soedirgo",- "author_image_url": "https://github.com/soedirgo.png"+ "author_url": "https://github.com/kangmingtay",+ "author_image_url": "https://github.com/kangmingtay.png"},- "fracek": {- "author": "Francesco Ceccon",- "author_url": "https://github.com/fracek",+ {+ "author_id": "oli_rice",+ "author": "Oliver Rice",+ "username": "olirice","position": "Engineering",- "username": "fracek",- "author_image_url": "https://github.com/fracek.png"+ "author_url": "https://github.com/olirice",+ "author_image_url": "https://github.com/olirice.png"+ },+ {+ "author_id": "paul_copplestone",+ "author": "Paul Copplestone",+ "position": "CEO and Co-Founder",+ "author_url": "https://github.com/kiwicopple",+ "author_image_url": "https://github.com/kiwicopple.png"+ },+ {+ "author_id": "rory_wilding",+ "author": "Rory Wilding",+ "position": "Head of Growth",+ "author_url": "https://github.com/roryw10",+ "author_image_url": "https://github.com/roryw10.png"},- "steve_chavez": {+ {+ "author_id": "steve_chavez","author": "Steve Chavez",- "author_url": "https://github.com/steve-chavez",- "position": "Engineering & PostgREST maintainer","username": "steve-chavez",+ "position": "Engineering & PostgREST maintainer",+ "author_url": "https://github.com/steve-chavez","author_image_url": "https://github.com/steve-chavez.png"},- "kangmingtay": {- "author": "Kang Ming Tay",- "author_url": "https://github.com/kangmingtay",- "position": "Engineering",- "username": "kangmingtay",- "author_image_url": "https://github.com/kangmingtay.png"- },- "div_arora": {- "author": "Div Arora",- "author_url": "https://github.com/darora",- "position": "Engineering",- "username": "darora",- "author_image_url": "https://github.com/darora.png"+ {+ "author_id": "supabase",+ "author": "Supabase",+ "position": "",+ "author_url": "https://github.com/supabase",+ "author_image_url": "https://github.com/supabase.png"},- "gurjeet": {- "author": "Gurjeet Singh",- "author_url": "https://github.com/gurjeet",- "position": "Engineering",- "username": "gurjeet",- "author_image_url": "https://github.com/gurjeet.png"+ {+ "author_id": "thor_schaeff",+ "author": "Thor Schaeff",+ "position": "DevRel & DX",+ "author_url": "https://github.com/thorwebdev",+ "author_image_url": "https://github.com/thorwebdev.png"},- "wenbo_xie": {+ {+ "author_id": "wenbo_xie","author": "Wen Bo Xie",- "author_url": "https://github.com/w3b6x9",- "position": "Engineering","username": "w3b6x9",- "author_image_url": "https://github.com/w3b6x9.png"- },- "oli_rice": {- "author": "Oliver Rice",- "author_url": "https://github.com/olirice","position": "Engineering",- "username": "olirice",- "author_image_url": "https://github.com/olirice.png"+ "author_url": "https://github.com/w3b6x9",+ "author_image_url": "https://github.com/w3b6x9.png"}-}+]diff --git a/www/pages/blog.tsx b/www/pages/blog.tsxindex 02d3e89fa3b..04aff41873e 100644--- a/www/pages/blog.tsx+++ b/www/pages/blog.tsx@@ -132,7 +132,18 @@ function Blog(props: any) {function FeaturedThumb(blog: PostTypes) {// @ts-ignore- const author = blog.author ? authors[blog.author] : authors['supabase']+ const authorArray = blog.author.split(',')++ const author = []+ for (let i = 0; i < authorArray.length; i++) {+ // @ts-ignore+ author.push(+ authors.find((authors: string) => {+ // @ts-ignore+ return authors.author_id === authorArray[i]+ })+ )+ }return (<div key={blog.slug} className="cursor-pointer w-full">@@ -157,24 +168,26 @@ function FeaturedThumb(blog: PostTypes) {<p className="p text-xl">{blog.description}</p></div>- {author && (- <div className="flex space-x-3 items-center">- {author.author_image_url && (- <div className="relative overflow-auto w-10 h-10">- <Image- src={author.author_image_url}- className="rounded-full"- layout="fill"- objectFit="cover"- />+ {author.map((author: any) => {+ return (+ <div className="flex space-x-3 items-center">+ {author.author_image_url && (+ <div className="relative overflow-auto w-10 h-10">+ <Image+ src={author.author_image_url}+ className="rounded-full"+ layout="fill"+ objectFit="cover"+ />+ </div>+ )}+ <div className="flex flex-col">+ <span className="m-0 text-sm text-scale-1200">{author.author}</span>+ <span className="m-0 text-xs text-scale-900">{author.position}</span></div>- )}- <div className="flex flex-col">- <span className="m-0 text-sm text-scale-1200">{author.author}</span>- <span className="m-0 text-xs text-scale-900">{author.position}</span></div>- </div>- )}+ )+ })}</div></a></a>diff --git a/www/pages/blog/[year]/[month]/[day]/[slug].tsx b/www/pages/blog/[year]/[month]/[day]/[slug].tsxindex 6345fdfc31b..535a7ab36c1 100644--- a/www/pages/blog/[year]/[month]/[day]/[slug].tsx+++ b/www/pages/blog/[year]/[month]/[day]/[slug].tsx@@ -88,8 +88,19 @@ export async function getStaticProps({ params }: any) {function BlogPostPage(props: any) {// @ts-ignore- const author = props.blog.author ? authors[props.blog.author] : authors['supabase']const content = hydrate(props.blog.content, { components })+ const authorArray = props.blog.author.split(',')++ const author = []+ for (let i = 0; i < authorArray.length; i++) {+ // @ts-ignore+ author.push(+ authors.find((authors: string) => {+ // @ts-ignore+ return authors.author_id === authorArray[i]+ })+ )+ }const { basePath } = useRouter()@@ -204,31 +215,39 @@ function BlogPostPage(props: any) {<p>•</p><p>{generateReadingTime(props.blog.content.renderedOutput)}</p></div>- {author && (- <div className="mt-6 mb-8 lg:mb-0 w-max">- <Link href={author.author_url}>- <a className="cursor-pointer">- <div className="flex gap-3 items-center">- {author.author_image_url && (- <div className="w-10">- <Image- src={author.author_image_url}- className="rounded-full border dark:border-dark"- width="100%"- height="100%"- layout="responsive"- />+ <div className="flex">+ {author.map((author: any) => {+ return (+ <div className="mt-6 mb-8 mr-4 lg:mb-0 w-max">+ <Link href={author.author_url}>+ <a className="cursor-pointer">+ <div className="flex gap-3 items-center">+ {author.author_image_url && (+ <div className="w-10">+ <Image+ src={author.author_image_url}+ className="rounded-full border dark:border-dark"+ width="100%"+ height="100%"+ layout="responsive"+ />+ </div>+ )}+ <div className="flex flex-col">+ <span className="text-sm text-scale-1200 mb-0">+ {author.author}+ </span>+ <span className="text-xs mb-0 text-scale-900">+ {author.position}+ </span>+ </div></div>- )}- <div className="flex flex-col">- <span className="text-sm text-scale-1200 mb-0">{author.author}</span>- <span className="text-xs mb-0 text-scale-900">{author.position}</span>- </div>- </div>- </a>- </Link>- </div>- )}+ </a>+ </Link>+ </div>+ )+ })}+ </div></div></div><div className="grid grid-cols-12 lg:gap-16 xl:gap-8">