Skip to content

[codex] fix short meta descriptions#645

Merged
riderx merged 5 commits into
mainfrom
codex/fix-short-meta-descriptions
May 6, 2026
Merged

[codex] fix short meta descriptions#645
riderx merged 5 commits into
mainfrom
codex/fix-short-meta-descriptions

Conversation

@riderx
Copy link
Copy Markdown
Member

@riderx riderx commented May 6, 2026

Summary

  • expand short web and docs meta descriptions to an SEO-safe length
  • overwrite existing Starlight description tags instead of leaving short defaults in place
  • extend localized translated meta descriptions and bump the translation cache version so existing localized pages regenerate

Validation

  • bunx prettier --write apps/web/src/components/SEO.astro apps/docs/src/components/doc/Head.astro apps/translation-worker/src/index.ts apps/translation-worker/scripts/verify-parser.ts
  • bun run check
  • bun run build
  • bun run build:after
  • CSV verification script: 407 generated English pages checked, 2,532 localized rows simulated through the translation worker, 0 short descriptions left

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced SEO meta descriptions with improved localization support across documentation and web pages.
    • Meta descriptions now include automatic normalization and intelligent length constraints to meet SEO standards.
    • Added fallback descriptions to ensure consistent metadata presentation in all languages.
  • Tests

    • Added verification tests for localized meta description handling and SEO compliance.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

Warning

Rate limit exceeded

@riderx has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 51 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c12284de-cfae-4449-ba85-458d80a6d87a

📥 Commits

Reviewing files that changed from the base of the PR and between f5f058e and e3ab7a2.

📒 Files selected for processing (4)
  • apps/docs/src/components/doc/Head.astro
  • apps/translation-worker/scripts/verify-parser.ts
  • apps/translation-worker/src/index.ts
  • apps/web/src/components/SEO.astro
📝 Walkthrough

Walkthrough

This PR introduces a modular metadata description generation pipeline for SEO optimization across documentation and web components, plus locale-aware description handling in the translation worker. New utility functions normalize, constrain, and extend meta descriptions with fallback text. The translation cache version is updated.

Changes

SEO Meta Description Pipeline

Layer / File(s) Summary
Constants & Configuration
apps/translation-worker/src/index.ts
Define SEO description constraints (min/max length 120–159 chars), fallback suffixes per locale, and meta tag keys for targeted processing.
Core Description Builders
apps/translation-worker/src/index.ts, apps/docs/src/components/doc/Head.astro, apps/web/src/components/SEO.astro
Introduce buildMetaDescription(), truncateSeoDescription(), buildSeoMetaDescription(), and normalizeMetaDescription() functions that normalize whitespace, enforce length limits, and append locale-aware fallback text when descriptions are too short.
Translation Expansion
apps/translation-worker/src/index.ts
Add expandShortMetaDescriptions() to rewrite meta description tags in translated HTML, and wire it into the metadata rewriting flow during translation processing. Update cache version to reflect SEO changes.
Component Integration
apps/docs/src/components/doc/Head.astro, apps/web/src/components/SEO.astro
Replace inlined meta description logic with calls to buildMetaDescription(), providing entry/content descriptions and defaulting to localized fallback text when needed.
Test Coverage
apps/translation-worker/scripts/verify-parser.ts
Add test block to verify localized meta descriptions remain within SEO length bounds and that Open Graph descriptions match normalized descriptions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Cap-go/website#624: Updates translation worker cache version and translation-related helpers in apps/translation-worker/src/index.ts.

Poem

🐰 A fluffy hop through SEO's glow,
Where short descriptions learn and grow,
With length constraints and locale care,
The metadata now flows everywhere!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title '[codex] fix short meta descriptions' directly addresses the main objective of the PR: expanding and fixing short meta descriptions to SEO-safe lengths across web, docs, and translation systems.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-short-meta-descriptions

Comment @coderabbitai help to get the list of available commands and usage tips.

@riderx riderx marked this pull request as ready for review May 6, 2026 11:45
@riderx
Copy link
Copy Markdown
Member Author

riderx commented May 6, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@riderx
Copy link
Copy Markdown
Member Author

riderx commented May 6, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@riderx
Copy link
Copy Markdown
Member Author

riderx commented May 6, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/web/src/components/SEO.astro (1)

172-175: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Twitter meta tags use raw props instead of processed values, causing inconsistency with Open Graph tags.

Lines 172-175 use the raw url, title, and image props, while corresponding Open Graph tags (lines 144-148) use the processed urlString, titleString, and imageUrl. This inconsistency can cause:

  • twitter:url receiving a URL object instead of a string (line 172 vs 144)
  • twitter:title being empty if the title prop wasn't provided (line 174 vs 145)
  • twitter:image not resolving to the full absolute URL (line 175 vs 148)
🐛 Proposed fix to use processed values
 <!-- Twitter -->
-<meta property="twitter:url" content={url} />
+<meta property="twitter:url" content={urlString} />
 <meta property="twitter:site" content="@Capgo_app" />
-<meta property="twitter:title" content={title} />
-<meta property="twitter:image" content={image} />
+<meta property="twitter:title" content={titleString} />
+<meta property="twitter:image" content={imageUrl} />
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/components/SEO.astro` around lines 172 - 175, The Twitter meta
tags in SEO.astro are using raw props (url, title, image) instead of the
processed values used by the Open Graph tags; update the twitter meta tag values
for "twitter:url", "twitter:title", and "twitter:image" to use the processed
variables urlString, titleString, and imageUrl respectively so they match the OG
tags and ensure strings/absolute URLs are emitted.
🧹 Nitpick comments (1)
apps/docs/src/components/doc/Head.astro (1)

151-156: 💤 Low value

Duplicate twitter:description meta tags with different attribute types.

Lines 154-155 set twitter:description twice—once with name and once with property. Twitter cards officially use name, so the property variant (line 155) may be redundant. If this is intentional for crawler compatibility, consider adding a brief comment. Otherwise, removing line 155 simplifies the output.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/docs/src/components/doc/Head.astro` around lines 151 - 156, The block
that sets meta tags creates duplicate twitter:description entries via
setHeadMetaContent('name','twitter:description', metaDescription) and
setHeadMetaContent('property','twitter:description', metaDescription); update
the code in the Head.astro component to remove the redundant property-based
twitter tag so only the standard name-based twitter:description is emitted (or
if the property variant is intentionally required for compatibility, keep it but
add a clear inline comment above the second setHeadMetaContent call explaining
why the duplicate exists); locate the calls to setHeadMetaContent and adjust
accordingly to ensure only one canonical twitter:description meta tag is
produced.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@apps/web/src/components/SEO.astro`:
- Around line 172-175: The Twitter meta tags in SEO.astro are using raw props
(url, title, image) instead of the processed values used by the Open Graph tags;
update the twitter meta tag values for "twitter:url", "twitter:title", and
"twitter:image" to use the processed variables urlString, titleString, and
imageUrl respectively so they match the OG tags and ensure strings/absolute URLs
are emitted.

---

Nitpick comments:
In `@apps/docs/src/components/doc/Head.astro`:
- Around line 151-156: The block that sets meta tags creates duplicate
twitter:description entries via setHeadMetaContent('name','twitter:description',
metaDescription) and setHeadMetaContent('property','twitter:description',
metaDescription); update the code in the Head.astro component to remove the
redundant property-based twitter tag so only the standard name-based
twitter:description is emitted (or if the property variant is intentionally
required for compatibility, keep it but add a clear inline comment above the
second setHeadMetaContent call explaining why the duplicate exists); locate the
calls to setHeadMetaContent and adjust accordingly to ensure only one canonical
twitter:description meta tag is produced.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4042286a-7336-490f-bdf6-bf46b4fe4404

📥 Commits

Reviewing files that changed from the base of the PR and between e72cc11 and f5f058e.

📒 Files selected for processing (4)
  • apps/docs/src/components/doc/Head.astro
  • apps/translation-worker/scripts/verify-parser.ts
  • apps/translation-worker/src/index.ts
  • apps/web/src/components/SEO.astro

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 6, 2026

@riderx
Copy link
Copy Markdown
Member Author

riderx commented May 6, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

…descriptions

# Conflicts:
#	apps/translation-worker/scripts/verify-parser.ts
#	apps/translation-worker/src/index.ts
@riderx riderx merged commit 7b390d7 into main May 6, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant