mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 18:05:11 +03:00
## What kind of change does this PR introduce? a11y bug fix on youtube embed ## What is the current behavior? YouTube iframes across guide pages have no `title` attribute, so screen readers announce them as an unnamed frame ## What is the new behavior? - extracts a `YouTube.tsx` ui component - adds `<YouTube id title />` + `title` as a required prop ## Test 1. visit `/docs/guides/ai/examples/openai` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Documentation** - Standardized embedded YouTube videos across guides with a consistent video player. - Added descriptive titles to improve accessibility and clarity. - Preserved existing video content and playback behavior. - Updated video embeds across AI, authentication, database, functions, realtime, self-hosting, storage, and migration documentation. - **New Features** - Added privacy-enhanced YouTube playback for embedded documentation videos. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
51 lines
1.3 KiB
Plaintext
51 lines
1.3 KiB
Plaintext
---
|
|
id: 'examples-og-image'
|
|
title: 'Generating OG Images'
|
|
description: 'Generate Open Graph images with Deno and Supabase Edge Functions.'
|
|
video: 'https://www.youtube.com/v/jZgyOJGWayQ'
|
|
---
|
|
|
|
<YouTube id="jZgyOJGWayQ" title="Generating OG images with Edge Functions" />
|
|
|
|
Generate Open Graph images with Deno and Supabase Edge Functions. [View on GitHub](https://github.com/supabase/supabase/tree/master/examples/edge-functions/supabase/functions/opengraph).
|
|
|
|
## Code
|
|
|
|
Create a `handler.tsx` file to construct the OG image in React:
|
|
|
|
```tsx handler.tsx
|
|
import { ImageResponse } from 'npm:@vercel/og@^0'
|
|
import React from 'npm:react@^19'
|
|
|
|
export default function handler(req: Request) {
|
|
return new ImageResponse(
|
|
<div
|
|
style={{
|
|
width: '100%',
|
|
height: '100%',
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
fontSize: 128,
|
|
background: 'lavender',
|
|
}}
|
|
>
|
|
Hello OG Image!
|
|
</div>
|
|
)
|
|
}
|
|
```
|
|
|
|
Create an `index.ts` file to execute the handler on incoming requests:
|
|
|
|
```ts index.ts
|
|
import { withSupabase } from 'npm:@supabase/server@^1'
|
|
|
|
import handler from './handler.tsx'
|
|
|
|
console.log('Hello from og-image Function!')
|
|
|
|
// Public image endpoint, so deploy with --no-verify-jwt.
|
|
export default { fetch: withSupabase({ auth: 'none' }, handler) }
|
|
```
|