Skip to content

[Enhancement] Generate dynamic Open Graph (OG) social cards using @vercel/og #2452

Description

@Neelr1912

🎯 Overview

When links to Gitverse profiles or repositories are shared on Twitter/X, Discord, or LinkedIn, they currently likely rely on a static fallback meta image. We should leverage Next.js's native Image Response API to generate dynamic, personalized social cards on the fly.

💡 Expected Behavior

When someone shares gitverse.app/u/username, the Next.js edge function dynamically generates an image containing:

  1. The user's GitHub avatar.
  2. Their total star count and repository count.
  3. A beautiful gradient background matching the Gitverse theme.

⚙️ Implementation Details

  1. Create a new API route: app/api/og/route.tsx.
  2. Import ImageResponse from next/og.
  3. Fetch basic GitHub stats using the username passed via query parameters (e.g., ?user=nisshchayarathi).
  4. Design the card layout using standard HTML/Tailwind CSS within the ImageResponse return block.
  5. Add the dynamic API endpoint to the metadata export in app/layout.tsx or app/[username]/page.tsx.

مزایا (Benefits)

  • Massive boost to social sharing and SEO.
  • Zero extra bundle size for the client, as it's generated at the edge.
  • Excellent showcase of Next.js 14+ App Router capabilities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requestinfraInfrastructure, CI, deployment, or tooling work.uiThis is a ui change

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions