Commit 84ff015
authored
fix(og): resolve OpenGraph query parameter desynchronization (JhaSourav07#549)
## Description
Fixes JhaSourav07#540
This PR resolves an OpenGraph metadata desynchronization issue that
caused social preview cards to render fallback metadata (`@unknown` and
empty contribution stats) across platforms such as Discord, X/Twitter,
LinkedIn, and Slack.
The issue originated from a query parameter mismatch between dashboard
metadata generation and the `/api/og` route validation schema.
Previously:
/api/og?username=${username}
However, the OpenGraph route expected:
user
Because the parameter names were inconsistent, the validation layer
parsed the `user` field as undefined and automatically fell back to the
default value `'unknown'`.
This caused:
- incorrect social preview metadata
- empty contribution statistics
- broken OpenGraph preview rendering
- degraded sharing experience across platforms
---
## Changes Implemented
### Query Parameter Synchronization
Updated dashboard metadata generation:
From:
/api/og?username=${username}
To:
/api/og?user=${username}
### Regression Test Update
Updated the metadata validation test to ensure:
- the correct query parameter is generated
- future regressions are detected automatically
---
## Files Changed
- `app/(root)/dashboard/[username]/page.tsx`
- `app/(root)/dashboard/[username]/page.test.tsx`
---
## Root Cause
The metadata generator and the OpenGraph validation schema used
different query parameter names.
Metadata generator:
- `username`
Validation schema:
- `user`
This mismatch caused the OG route to fall back to default metadata
values instead of rendering real GitHub profile data.
---
## Validation
Successfully verified with:
- `npm run test`
- `npm run lint`
- `npm run build`
### Test Results
- 22/22 test suites passed
- 275/275 tests passed
- Production build compiled successfully
---
## Functional Verification
Validated successfully across:
- direct `/api/og` route rendering
- Discord previews
- X/Twitter previews
- LinkedIn previews
- Slack embeds
The correct GitHub username and contribution statistics now render
properly in OpenGraph images and social cards.
---
## Impact
This PR fixes:
- broken OpenGraph previews
- fallback `@unknown` metadata rendering
- incorrect social embed statistics
- metadata desynchronization between route generation and validation
while preserving:
- existing metadata behavior
- route architecture
- TypeScript compatibility
- backward compatibility
---
## Pillar
- [ ] 🎨 Pillar 1 — New Theme Design
- [ ] 📐 Pillar 2 — Geometric SVG Improvement
- [ ] 🕐 Pillar 3 — Timezone Logic Optimization
- [x] 🛠️ Other (Bug fix, refactoring, docs)
---
## Visual Preview
N/A — OpenGraph metadata synchronization fix
---
## Checklist before requesting a review:
- [x] I have read the `CONTRIBUTING.md` file.
- [x] I have tested these changes locally.
- [x] I have run `npm run format` and `npm run lint` locally and
resolved all errors.
- [x] My commits follow the Conventional Commits format.
- [x] I have started the repo.
- [x] I have made sure that I have only one commit in this PR.
- [x] All tests and production builds pass successfully.2 files changed
Lines changed: 71 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
54 | 63 | | |
55 | 64 | | |
56 | 65 | | |
| |||
402 | 411 | | |
403 | 412 | | |
404 | 413 | | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
405 | 434 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
208 | 217 | | |
209 | 218 | | |
210 | 219 | | |
| |||
0 commit comments