@@ -27,6 +27,7 @@ import { NotionRenderer } from "vendor/react-notion-x/packages/react-notion-x";
27
27
28
28
import { Footer } from "~/components/organisms/Footer" ;
29
29
import { Tables } from "~/integrations/supabase/database.types" ;
30
+ import { getPostImageUrl } from "~/utils/supabase" ;
30
31
import { useTheme } from "~/utils/theme" ;
31
32
32
33
const Equation = React . lazy ( ( ) =>
@@ -111,11 +112,11 @@ const NotionPage = ({ recordMap }: { recordMap: ExtendedRecordMap }) => {
111
112
export const loader : LoaderFunction = async ( {
112
113
params,
113
114
} : LoaderFunctionArgs ) => {
114
- const supabase = createClient (
115
+ const supabaseClient = createClient (
115
116
process . env . SUPABASE_URL ! ,
116
117
process . env . SUPABASE_SERVICE_ROLE_KEY ! ,
117
118
) ;
118
- const { data, error } = await supabase
119
+ const { data, error } = await supabaseClient
119
120
. from ( "posts" )
120
121
. select ( "*" )
121
122
. eq ( "slug" , params . slug )
@@ -124,6 +125,7 @@ export const loader: LoaderFunction = async ({
124
125
125
126
if ( error ) throw new Response ( "Failed to load post" , { status : 500 } ) ;
126
127
if ( ! data ) throw new Response ( "Post not found" , { status : 404 } ) ;
128
+ data . image_url = getPostImageUrl ( supabaseClient , data . image_url ) ;
127
129
128
130
const notion = new NotionAPI ( ) ;
129
131
const recordMapPromise = notion . getPage ( data . notion_page_id ) ;
@@ -186,11 +188,11 @@ export const handle: SEOHandle = {
186
188
* @returns The sitemap.xml entries for the route
187
189
*/
188
190
getSitemapEntries : async ( ) => {
189
- const supabase = createClient (
191
+ const supabaseClient = createClient (
190
192
process . env . SUPABASE_URL ! ,
191
193
process . env . SUPABASE_SERVICE_ROLE_KEY ! ,
192
194
) ;
193
- const { data : posts } = await supabase
195
+ const { data : posts } = await supabaseClient
194
196
. from ( "posts" )
195
197
. select ( "slug" )
196
198
. returns < Tables < "posts" > [ ] > ( ) ;
@@ -268,7 +270,7 @@ export default function BlogPostRoute() {
268
270
const { post, recordMap } = useLoaderData < typeof loader > ( ) ;
269
271
270
272
return (
271
- < div className = "mx-auto flex min-h-screen w-full max-w-[800px ] flex-col px-4 sm:px-6 lg:px-8" >
273
+ < div className = "mx-auto flex min-h-screen w-full max-w-[850px ] flex-col px-4 sm:px-6 lg:px-8" >
272
274
< header className = "mt-4" >
273
275
< div className = "flex items-center gap-2 text-3xl font-semibold sm:text-4xl" >
274
276
< Link to = "/blog" > <</ Link >
0 commit comments