Skip to content

(SP: 2) [Frontend] Fix Open Graph (OG) meta + Twitter Card#290

Merged
ViktorSvertoka merged 3 commits into
developfrom
fix/og-preview
Feb 7, 2026
Merged

(SP: 2) [Frontend] Fix Open Graph (OG) meta + Twitter Card#290
ViktorSvertoka merged 3 commits into
developfrom
fix/og-preview

Conversation

@ViktorSvertoka
Copy link
Copy Markdown
Member

@ViktorSvertoka ViktorSvertoka commented Feb 7, 2026

Summary

  • Set metadataBase to resolve OG URLs from NEXT_PUBLIC_SITE_URL
  • Use relative /og.png for consistent OG/Twitter images
  • Add localized Open Graph/Twitter metadata on the home page

Closes #288

Summary by CodeRabbit

  • New Features

    • Streamlined page titles (removed suffix) and improved SEO metadata with canonical URLs, per-locale alternates, locale mappings, and enhanced Open Graph/Twitter previews (title, description, image, locale).
  • Chores

    • Made site base URL configurable via environment variable and updated image references to relative paths for consistent metadata delivery.

@ViktorSvertoka ViktorSvertoka self-assigned this Feb 7, 2026
@ViktorSvertoka ViktorSvertoka added the bug Something isn't working label Feb 7, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 7, 2026

Deploy Preview for develop-devlovers ready!

Name Link
🔨 Latest commit 578e909
🔍 Latest deploy log https://app.netlify.com/projects/develop-devlovers/deploys/69878751116c340008e61e31
😎 Deploy Preview https://deploy-preview-290--develop-devlovers.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Feb 7, 2026

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

Project Deployment Actions Updated (UTC)
devlovers-net Ready Ready Preview, Comment Feb 7, 2026 6:42pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 7, 2026

Warning

Rate limit exceeded

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

⌛ 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.

📝 Walkthrough

Walkthrough

Removes a title suffix and adds locale-aware metadata (siteUrl, canonical/alternate URLs, ogLocale), expands Open Graph and Twitter Card fields, and switches OG/Twitter image URLs to a relative /og.png. Updates metadataBase to use runtime siteUrl.

Changes

Cohort / File(s) Summary
Locale-aware Page Metadata
frontend/app/[locale]/page.tsx
Removed title suffix; added runtime siteUrl, canonicalUrl, localeMap, ogLocale; added alternates (canonical + per-language URLs); expanded openGraph (title, description, url, siteName, image, locale, type) and twitter metadata (card, title, description, image).
Layout Metadata Base & Images
frontend/app/layout.tsx
Introduced siteUrl from NEXT_PUBLIC_SITE_URL (with fallback) and set metadataBase to new URL(siteUrl); replaced absolute OG/Twitter image URLs with relative /og.png; used dynamic siteUrl for Open Graph url.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • AM1007

Poem

🐰 I hopped in code with tiny paws,
Swapped titles, set the site’s true cause,
Locales mapped and ogs unfurled,
og.png waves across the world,
Share the joy — the rabbit applause! 🎉

🚥 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 clearly indicates the main change: fixing Open Graph and Twitter Card metadata on the frontend.
Linked Issues check ✅ Passed The PR implements all required Open Graph metadata (og:title, og:description, og:image, og:url) and Twitter Card metadata as specified in issue #288.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing Open Graph and Twitter Card metadata as required in the linked issue #288.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/og-preview

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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.

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (1)
frontend/app/layout.tsx (1)

1-7: ⚠️ Potential issue | 🟡 Minor

Duplicate globals.css import.

./globals.css is imported on both Line 1 and Line 7. One should be removed.

Proposed fix
 import './globals.css';
 
 import type { Metadata } from 'next';
 import { Geist, Geist_Mono } from 'next/font/google';
 import { Analytics } from '@vercel/analytics/next';
 import { SpeedInsights } from '@vercel/speed-insights/next';
-import './globals.css';
🤖 Fix all issues with AI agents
In `@frontend/app/`[locale]/page.tsx:
- Line 26: The metadata's url currently uses the global siteUrl constant; change
it to the locale-specific canonical URL by concatenating siteUrl with the locale
path segment (use the locale/params.locale value available in this page
component) so each localized page outputs a unique URL; update the metadata
entry (where url: siteUrl is set) to build and use the locale-aware URL,
handling slashes properly (avoid double slashes) so social platforms see the
correct localized URL.
🧹 Nitpick comments (2)
frontend/app/layout.tsx (1)

9-9: siteUrl is duplicated across layout.tsx and page.tsx.

Consider extracting this into a shared constant (e.g., lib/constants.ts) to avoid drift if the env variable name or fallback ever changes.

frontend/app/[locale]/page.tsx (1)

28-34: OG image alt text is hardcoded in English on a localized page.

Since you already have the translation function t available, consider localizing the alt text (or at least using t('title')) for consistency with the rest of the metadata.

Proposed fix
-          alt: 'DevLovers — Technical Interview Platform',
+          alt: t('title'),

Comment thread frontend/app/[locale]/page.tsx Outdated
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.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@frontend/app/`[locale]/page.tsx:
- Around line 38-45: Replace the hardcoded OG image alt string in the metadata
images array with a localized value using the page's translator (e.g., call
t('ogImageAlt') instead of the literal 'DevLovers — Technical Interview
Platform'); update the metadata construction in page.tsx so the translator
instance used for title/description is also used to produce images[0].alt, and
add the new translation key 'ogImageAlt' to the locale files to keep alt text
consistent across locales.
🧹 Nitpick comments (2)
frontend/app/[locale]/page.tsx (2)

13-14: Redundant ternary — both branches produce the same result.

Both arms evaluate to `${siteUrl}/${locale}`, so the locale === 'en' check is a no-op. If the intent was to map en to the root path (siteUrl without a segment), the 'en' branch should be siteUrl alone. Otherwise, simplify:

Proposed simplification
-  const canonicalUrl =
-    locale === 'en' ? `${siteUrl}/en` : `${siteUrl}/${locale}`;
+  const canonicalUrl = `${siteUrl}/${locale}`;

15-31: Locale lists are hardcoded in multiple places.

localeMap (lines 15-19) and alternates.languages (lines 27-31) both enumerate the supported locales. If the project already has a central locale config (typical with next-intl), consider deriving these from it to avoid drift when locales change.

Comment thread frontend/app/[locale]/page.tsx
@ViktorSvertoka ViktorSvertoka merged commit 7fa64dd into develop Feb 7, 2026
10 checks passed
@ViktorSvertoka ViktorSvertoka deleted the fix/og-preview branch February 7, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant