Skip to content

fix: Fix OG image text overlap for long titles and descriptions#1303

Merged
yamcodes merged 1 commit into
devfrom
1302-fix-og-image-text-overlap-for-long-titles-and-descriptions
Jul 11, 2026
Merged

fix: Fix OG image text overlap for long titles and descriptions#1303
yamcodes merged 1 commit into
devfrom
1302-fix-og-image-text-overlap-for-long-titles-and-descriptions

Conversation

@yamcodes

Copy link
Copy Markdown
Owner

Fixes #1302

Truncate long title and description strings in the /api/og route before passing them to generateOGImage, preventing text overlap in the fumadocs 1200×630 template. Short metadata is left unchanged.

Test plan

  • Unit tests for formatOgTitle / formatOgDescription (short, long title, long description, word boundaries)
  • Route test for the using-other-validators page metadata
  • pnpm run typecheck, pnpm run test, pnpm run fix pass

Made with Cursor

Truncate long OG title and description text before rendering to prevent
overlap in the fumadocs 1200×630 template.

Co-authored-by: Cursor <cursoragent@cursor.com>
@yamcodes yamcodes added bug Something isn't working www Improvements or additions to arkenv.js.org labels Jul 11, 2026
@yamcodes yamcodes linked an issue Jul 11, 2026 that may be closed by this pull request
4 tasks
@changeset-bot

changeset-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: bea488a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added the tests This issue or PR is about adding, removing or changing tests label Jul 11, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes — the PR adds title/description truncation helpers for the dynamic /api/og route to prevent text overlap in the fumadocs 1200×630 OG image template.

  • Add apps/www/lib/og-text.ts — introduces formatOgTitle (42-char limit), formatOgDescription (75-char limit), and a shared truncateOgText helper that normalizes whitespace and prefers word-boundary truncation.
  • Update apps/www/app/api/og/route.tsx — applies the new formatters to title and description before passing them to generateOGImage.
  • Add unit and route tests — covers short strings, long title/description, word-boundary behavior, and the real metadata case that prompted the fix.

Pullfrog  | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

@arkenv-bot

arkenv-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (Asia/Almaty)
arkenv Ready Ready Preview, Comment Jul 11 2026, 7:34 PM (Asia/Almaty)

@yamcodes
yamcodes merged commit ba2111a into dev Jul 11, 2026
20 checks passed
@yamcodes
yamcodes deleted the 1302-fix-og-image-text-overlap-for-long-titles-and-descriptions branch July 11, 2026 14:53
yamcodes added a commit that referenced this pull request Jul 12, 2026
## Summary

Forward-ports two clean fixes from `dev` to `v1` using cherry-pick (not
a bulk merge):

- **OG text overflow fix** (#1303 / #1302) — cherry-picked `ba2111ab`
- **Vitest project name collision** — exclude legacy `packages/cli` stub
from root vitest projects

## Context

`dev` and `v1` are intentionally diverged (see CONTRIBUTING Use Case 4).
The recent reconciliation (#1292) only covered v0 feature parity (#1281,
#1282) — it did not eliminate the ~48 file conflicts that appear when
bulk-merging the branches. Those conflicts are expected due to
structural differences (`packages/cli` → `packages/arkenv`, removed
`/shared` exports, etc.).

This PR uses the documented **forward-porting** workflow instead.

## Test plan

- [x] `pnpm test run lib/og-text.test.ts app/api/og/route.test.tsx`
passes (7/7)
- [x] Root vitest starts without duplicate project name error

Made with [Cursor](https://cursor.com)

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working tests This issue or PR is about adding, removing or changing tests www Improvements or additions to arkenv.js.org

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix OG image text overlap for long titles and descriptions

1 participant