Performance: Open Graph and Twitter cards
MEDIUM IMPACT
This affects the page load speed and initial rendering by adding metadata that social platforms use to generate rich previews.
import Head from 'next/head'; export default function Page() { return ( <> <Head> <meta property="og:title" content="My Page" /> <meta property="og:description" content="Description here" /> <meta property="og:image" content="/optimized-image.webp" /> <meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:image" content="/optimized-image.webp" /> </Head> <main>Content</main> </> ); }
import Head from 'next/head'; export default function Page() { return ( <> <Head> <meta property="og:title" content="My Page" /> <meta property="og:description" content="Description here" /> <meta property="og:image" content="/large-image.jpg" /> <meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:image" content="/large-image.jpg" /> </Head> <main>Content</main> </> ); }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Large unoptimized OG image | Minimal (metadata only) | 0 | High due to image load delay | [X] Bad |
| Optimized OG image with compressed format | Minimal (metadata only) | 0 | Low paint cost | [OK] Good |
| Metadata with blocking scripts in head | Minimal | 0 | High due to render-blocking | [X] Bad |
| Metadata only, no blocking scripts | Minimal | 0 | Low paint cost | [OK] Good |