Skip to content

fix: key meta tags by property so og:* tags stop collapsing#1

Merged
MatthewPattell merged 1 commit into
Lomray-Software:prodfrom
melissa-lomray:fix/og-meta-property-dedup
Jun 24, 2026
Merged

fix: key meta tags by property so og:* tags stop collapsing#1
MatthewPattell merged 1 commit into
Lomray-Software:prodfrom
melissa-lomray:fix/og-meta-property-dedup

Conversation

@melissa-lomray

Copy link
Copy Markdown
Contributor

Problem (live on prod, sitewide)

Every page on lomray.com renders only a single og:image Open Graph tag — og:title, og:description, og:url, og:type, og:site_name, og:locale are all missing, even though the app's MetaData component emits them. (Verified by raw curl on home, a blog article, and /services/web-development — all show 1× og:image, 0× every other og:*. The 4 twitter:* tags survive.)

Root cause

Manager.buildKeyByProps only treats ['id', 'name', 'href', 'src'] as unique attributes. twitter:* tags use name= so each gets a distinct key and survives. og:* tags use property= — none of the unique attrs match, so they fall through to the prop-name fallback which builds the key from prop names ([property][content]), not values. Result: every <meta property=… content=…> collapses to the identical key meta[property][content], last-write-wins — only the last og tag (og:image) survives.

Fix

Add property to the unique-attr list so each og:* tag keeps a distinct key (meta[property='og:title'], etc). One line.

Tests

Added a regression test asserting 4 distinct og:* tags survive. Proven red→green: on the unfixed code it fails expected 1 to equal 4 (reproducing the prod symptom); with the fix the full suite is green (5/5). ts:check, eslint, and rollup build all clean.

Consumed by lomray-website at @lomray/react-head-manager@^2.0.2; after publish I'll bump the dep there.

buildKeyByProps only treated id/name/href/src as unique attributes, so
og:* tags (which use property=) fell through to the prop-name fallback
and all collided on the same key (meta[property][content]), last-write-
wins -> only og:image survived sitewide. Add property to the unique-attr
list so each og:* tag keeps a distinct key. Adds a regression test.
@melissa-lomray

melissa-lomray commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

@MatthewPattell review please — sitewide OG fix, one-line root cause, regression test red→green, full suite green. I lack write here so this is a fork PR; merge + publish is yours.

@MatthewPattell MatthewPattell added the bug Something isn't working label Jun 24, 2026
@MatthewPattell MatthewPattell merged commit 8defcc5 into Lomray-Software:prod Jun 24, 2026
2 of 3 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants