Skip to content

feat: add dynamic Open Graph image for homepage#87

Open
saurabhsingh72487-hub wants to merge 2 commits into
PRODHOSH:mainfrom
saurabhsingh72487-hub:feat/add-dynamic-og-image
Open

feat: add dynamic Open Graph image for homepage#87
saurabhsingh72487-hub wants to merge 2 commits into
PRODHOSH:mainfrom
saurabhsingh72487-hub:feat/add-dynamic-og-image

Conversation

@saurabhsingh72487-hub

@saurabhsingh72487-hub saurabhsingh72487-hub commented Jun 5, 2026

Copy link
Copy Markdown

Problem

The OSSfolio homepage did not have an og:image configured, causing shared links on platforms such as Twitter, LinkedIn, WhatsApp, and Discord to appear without a preview image.

Solution

Implemented a dynamic Open Graph image using Next.js ImageResponse and integrated it with the site's metadata.

Changes

  • Added src/app/opengraph-image.tsx to generate the Open Graph image dynamically.
  • Updated homepage Open Graph metadata to use the generated image.
  • Added metadataBase for proper absolute URL resolution.
  • Ensured the generated image follows the required 1200×630 Open Graph dimensions.
  • Used OSSfolio branding and metadata integration for link previews.

Implementation Notes

The issue recommended a static image approach (public/og-image.png), but this PR uses the Next.js native Open Graph image generation approach (opengraph-image.tsx).

This provides:

  • Easier future maintenance.
  • Dynamic image generation through code.
  • Centralized branding and metadata management.

Testing

  • Verified the Open Graph image route renders successfully.
  • Confirmed metadata is generated correctly.
  • Tested link preview metadata locally.

Related Issue

Closes #19

@github-actions github-actions Bot added the frontend Related to UI / Next.js label Jun 5, 2026
@PRODHOSH

PRODHOSH commented Jun 5, 2026

Copy link
Copy Markdown
Owner

@saurabhsingh72487-hub pls edit ur pr description according to the template
u can find the template in the repo
and also join the discord -> https://discord.gg/4VsyzxaNd6

and instead i see u did thru code instead of a image
but thats fine since ur a first time contributor

Generall workflow please read #19 and the CONTRIBUTING.md

For now edit the pr description with the template from the repo
and then i will merge

But before raising a pull request u hav to get assigned to an issue
so first u hav to comment in the issue explaining ur approach
next up after assigning u only u hav to raise a pr

pls join the discord if u have any doubts
thanks !

@PRODHOSH

PRODHOSH commented Jun 5, 2026

Copy link
Copy Markdown
Owner

i can give u a top label if u implement this

if u create a image using gemini nano banana for the open graph image
but the gemini image colors and everything should be relevant to our website

pls join the discord so i can explain u clearly

@PRODHOSH

PRODHOSH commented Jun 5, 2026

Copy link
Copy Markdown
Owner

@saurabhsingh72487-hub star the repo

@PRODHOSH PRODHOSH added ELUSOC ELUSOC project submission in-progress ADVENTURER Intermediate — 25 pts labels Jun 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a dynamic Open Graph image for the homepage using Next.js metadata image generation, and updates site metadata to resolve OG URLs correctly.

Changes:

  • Added src/app/opengraph-image.tsx to generate the OG image at runtime via next/og ImageResponse.
  • Added metadataBase and introduced homepage openGraph metadata in src/app/layout.tsx.
  • Updated Twitter card metadata to use a large-image card layout (but currently references a non-existent image path—see comments).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/app/opengraph-image.tsx Introduces runtime OG image generation for the root route segment.
src/app/layout.tsx Updates global metadata (base URL, Open Graph, Twitter) to integrate OG image behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/app/layout.tsx
description: "Your open-source identity, beyond GitHub.",
type: "website",
images: ["/logo.png"],
images: ["/og-image.png"],
Comment thread src/app/layout.tsx
Comment on lines +25 to +29
openGraph: {
title: "OSSfolio — Your Open Source Identity",
description: "Your open-source identity, beyond GitHub.",
type: "website",
},
Comment on lines +25 to +30
<img
src="https://ossfolio.qzz.io/logo.png"
width={180}
height={180}
/>

@github-actions github-actions Bot added the documentation Additions to docs label Jun 6, 2026
@PRODHOSH

PRODHOSH commented Jun 6, 2026

Copy link
Copy Markdown
Owner

@saurabhsingh72487-hub pls do the changes as i said in the comments
why is there documentation code in this pull request
Remove that

Pls ask doubts in the discord if u dont know the workflow in opensource
Happy to help!

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ADVENTURER Intermediate — 25 pts documentation Additions to docs ELUSOC ELUSOC project submission frontend Related to UI / Next.js in-progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Contribution Policy - Please Read Before Opening a PR

3 participants