diff --git a/apps/docs/layouts/guides/index.tsx b/apps/docs/layouts/guides/index.tsx index d6f245d989..2895705bc5 100644 --- a/apps/docs/layouts/guides/index.tsx +++ b/apps/docs/layouts/guides/index.tsx @@ -67,11 +67,11 @@ const Layout: FC = (props) => { // page type, ie, Auth, Database, Storage etc const ogPageType = asPath.split('/')[2] // open graph image url constructor - const ogImageUrl = `https://obuldanrptloktxcffvn.functions.supabase.co/og-images?site=docs${ - ogPageType ? `&type=${ogPageType}` : '' - }&title=${encodeURIComponent(props.meta?.title)}&description=${encodeURIComponent( - props.meta?.description - )}` + const ogImageUrl = encodeURIComponent( + `https://obuldanrptloktxcffvn.functions.supabase.co/og-images?site=docs${ + ogPageType ? `&type=${ogPageType}` : '' + }&title=${props.meta?.title}&description=${props.meta?.description}` + ) return ( <> diff --git a/supabase/functions/og-images/component/Docs.tsx b/supabase/functions/og-images/component/Docs.tsx index 4ccd920950..5b38579c08 100644 --- a/supabase/functions/og-images/component/Docs.tsx +++ b/supabase/functions/og-images/component/Docs.tsx @@ -9,6 +9,18 @@ type Props = { const Docs = (props: Props) => { const { type, title, description, icon } = props + + let typeName: string | undefined = type?.replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase()) + let typeIcon: string | undefined = type?.toLowerCase() + + if (type === 'functions' || type === 'function') { + typeName = 'Edge Functions' + } else if (type === 'self-hosting') { + typeIcon = 'resources' + } else if (type === 'cli') { + typeName = 'CLI' + typeIcon = 'reference-cli' + } return (
{ {type && ( <>
- +
- {type.substring(0, 1).toUpperCase() + title.substring(1)} + {typeName} )}