Skip to content

fix(og-tags): detect mixed-case property values and name-attribute fallback (PRE-2238) - #4

Merged
marceloprerender merged 2 commits into
mainfrom
fix/og-tag-detection-pre-2238
May 5, 2026
Merged

marceloprerender merged 2 commits into
mainfrom
fix/og-tag-detection-pre-2238

Conversation

@marceloprerender

Copy link
Copy Markdown
Contributor

Summary

Fixes the long-standing customer-visible bug where the SEO score modal in the Prerender dashboard reports OG meta tags as missing when they are present in the cached HTML.

The current scorer only checks meta[property=\"og:...\"], but real-world pages use two other patterns it doesn't handle:

  • mixed-case attribute values — e.g. <meta property=\"OG:Title\" ...>. CSS attribute selectors are case-sensitive on values by default.
  • name attribute instead of property — used by some CMSes and SEO plugins, e.g. <meta name=\"og:title\" ...>.

This PR makes detection robust to both patterns by using CSS Level 4 case-insensitive value matching ([attr=\"value\" i], supported by cheerio) and adding a name attribute fallback.

Empirical reproducer

A real customer page (lululemon KSA) declares all 5 OG tags with name= instead of property=:

<meta name=\"og:title\" content=\"...\">
<meta name=\"og:type\" content=\"website\">
<meta name=\"og:image\" content=\"...\">
<meta name=\"og:url\" content=\"...\">
<meta name=\"og:description\" content=\"...\">
Version Score OG-tag false positives
1.5.1 (current production) -15 All 5 reported missing
1.5.2 (this PR) 2 None

Changes

  • `src/checks/og-tags.check.ts` — extracted `findOgContent($, tag)` helper that tries `meta[property="og:..." i]` first, falls back to `meta[name="og:..." i]`.
  • `src/checks/og-tags.test.ts` — 4 new regression tests covering mixed-case values, `name`-attribute, mixed scenarios, and empty `content`.
  • `package.json` — bumped to 1.5.2.

Test plan

  • All 45 existing tests pass.
  • 4 new tests added and pass.
  • Verified against the real customer HTML — no false-positive OG recommendations.
  • Once published, bump `prerender-seo-scorer` to ^1.5.2 in monostack `services/dashboard-api/package.json` (and optionally `prerender-custom/package.json`) — this is what makes the fix reach customers' modal.

Related

  • Linear: PRE-2238
  • Linear: PRE-2716 — broader scoring-architecture cleanup
  • The monorepo's `@prerender/seo-scorer` package received a similar (but type-only) refactor in monostack PR #3122. That fix did not reach this package, and the customer-visible modal at `dashboard-api/v2/score` calls this package — so this PR is what actually closes PRE-2238 for customers.

@marceloprerender
marceloprerender force-pushed the fix/og-tag-detection-pre-2238 branch 5 times, most recently from 72dbe5a to a4a638d Compare May 5, 2026 12:49
…llback (PRE-2238)

The og-tag check was reporting tags as missing when they were present in
the HTML for two real-world patterns:

- mixed-case attribute values (e.g. property="OG:Title") — CSS attribute
  selectors are case-sensitive on values by default
- name="og:title" instead of property="og:title" — used by some CMSes
  and SEO plugins

Both now match. Bumps to 1.5.2.

Refs: https://linear.app/prerender/issue/PRE-2238
@marceloprerender
marceloprerender force-pushed the fix/og-tag-detection-pre-2238 branch from a4a638d to 1e3b286 Compare May 5, 2026 13:06
@marceloprerender
marceloprerender marked this pull request as ready for review May 5, 2026 13:06
actions/cache@v2 is deprecated and now hard-fails. Also bumps
checkout, setup-node, and action-gh-release to v4/v2 to avoid
upcoming deprecations. node-version 14.x → 18.x.
@marceloprerender
marceloprerender merged commit 30bbda2 into main May 5, 2026
6 checks passed
@marceloprerender
marceloprerender deleted the fix/og-tag-detection-pre-2238 branch May 5, 2026 13:11
@OpsBeaconCharles OpsBeaconCharles mentioned this pull request Aug 5, 2026
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