Skip to content

fix: fix meta#668

Merged
teleginzhenya merged 3 commits into
mainfrom
feature/fix-meta
Jun 30, 2026
Merged

fix: fix meta#668
teleginzhenya merged 3 commits into
mainfrom
feature/fix-meta

Conversation

@teleginzhenya

Copy link
Copy Markdown
Collaborator

Summary

Fix incorrect Open Graph metadata that caused wrong or inconsistent link previews when sharing subpages (e.g. in Telegram).

On pages like /ru/components/uikit/accordion, og:title, og:description, and og:image described the current page, but several other OG tags were wrong:

  • og:url was hardcoded to https://gravity-ui.com/ on every page
  • og:locale was always en, even on localized routes (/ru/, /de/, etc.)
  • og:site_name used the page title (e.g. UIKit – Accordion) instead of the site name

This conflicted with the correct <link rel="canonical"> and could cause crawlers (Telegram, Facebook, etc.) to associate subpages with the homepage preview or cache the wrong card.

Fix

  • Added src/utils/canonical.ts with shared helpers to build canonical URLs from locale + path (getCanonicalUrlForLocale) and from the router path (getCanonicalUrlFromAsPath)
  • Updated Meta.tsx to set:
    • og:url from the current page URL (matches canonical)
    • og:locale from the active locale
    • og:site_name to Gravity UI (constant, separate from page title)
  • Refactored _document.tsx to use the same canonical URL helper for <link rel="canonical">

@teleginzhenya teleginzhenya changed the title ix meta fix: fix meta Jun 30, 2026
imsitnikov
imsitnikov previously approved these changes Jun 30, 2026
@teleginzhenya teleginzhenya merged commit dd3025b into main Jun 30, 2026
2 checks passed
@teleginzhenya teleginzhenya deleted the feature/fix-meta branch June 30, 2026 12:38
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.

2 participants