Skip to content

thedaviddias/Front-End-Checklist / skills/og-url-match

og-url-match

Verified

Use when auditing Open Graph tags or investigating why social share counts appear low. Applies to any page with both canonical-url and og:url tags.

FileKindSize
SKILL.mdskill md2.1 KB
references/rule.mdmarkdown3.8 KB

references/rule.md

View on GitHub
# OG URL Match

> Checks that og:url matches canonical URL

**Priority:** medium · **Difficulty:** beginner · **Time:** 10 min

---
`og:url` defines the canonical identifier for a page as understood by social platforms. It should always match the `<link rel="canonical">` tag.

## Code Example

When a page is shared via different URL variants (with UTM parameters, session IDs, or www vs non-www differences), each variant gets its own share count unless `og:url` unifies them to a single URL.

```
User A shares: https://example.com/blog/post?utm_source=twitter  → 45 shares
User B shares: https://example.com/blog/post                     → 23 shares
User C shares: https://www.example.com/blog/post                 → 12 shares
```

Total: 80 shares, but Facebook shows 45, 23, and 12 separately.

## Why It Matters

When og:url doesn't match the canonical URL, social platforms track share counts separately for each URL variant—published share counts get split across multiple URLs and appear lower than they actually are.

## Correct Implementation

```html
<!-- ✅ Good: og:url matches canonical-url exactly -->
<head>
  <link rel="canonical" href="https://example.com/blog/sourdough-recipe" />
  <meta property="og:url" content="https://example.com/blog/sourdough-recipe" />
</head>
```

```html
<!-- ❌ Bad: og:url has tracking params that canonical-url doesn't -->
<head>
  <link rel="canonical" href="https://example.com/blog/sourdough-recipe" />
  <meta property="og:url" content="https://example.com/blog/sourdough-recipe?utm_source=homepage" />
</head>

<!-- ❌ Bad: og:url uses www, canonical-url doesn't -->
<head>
  <link rel="canonical" href="https://example.com/blog/sourdough-recipe" />
  <meta property="og:url" content="https://www.example.com/blog/sourdough-recipe" />
</head>

<!-- ❌ Bad: og:url uses HTTP, canonical-url uses HTTPS -->
<head>
  <link rel="canonical" href="https://example.com/blog/sourdough-recipe" />
  <meta property="og:url" content="http://example.com/blog/sourdough-recipe" />
</head>
```

## Next.js Implementation

```tsx
// app/blog/[slug]/page.tsx

  const post = await getPost(params.slug)
  const canonicalUrl = `https://example.com/blog/${params.slug}`

  return {
    alternates: {
      canonical: canonicalUrl,
    },
    openGraph: {
      url: canonicalUrl,   // ← must match canonical-url
      title: post.title,
      description: post.excerpt,
    },
  }
}
```

## Checklist

| Check | Expected |
|-------|----------|
| Protocol | Both use `https://` |
| Domain | Both use same domain (www or non-www) |
| Path | Identical paths |
| Query string | Neither has tracking parameters |
| Trailing slash | Consistent between both |

## Exceptions

- Utility or intentionally noindex pages may keep minimal metadata when richer search presentation is not a goal.
- Template-driven pages can look repetitive in isolation; confirm the fully rendered production output before flagging duplication or omission.
- If a page is intentionally redirected or excluded from indexation, resolve that crawlability decision before treating metadata polish as the primary issue.

## Standards

- Use these references as the standard for the final search-facing HTML, metadata, and crawl behavior.
- Check the implementation against The Open Graph Protocol before treating the rule as satisfied.
- Check the implementation against Facebook: Sharing best practices before treating the rule as satisfied.

## Verification

### Automated Checks

- View page source — compare `og:url` content and `canonical` href manually
- Use [Facebook Sharing Debugger](https://developers.facebook.com/tools/debug/) — shows the resolved og:url
- Use a site crawler (Screaming Frog) to export both fields and compare them in bulk

### Manual Checks

- Review representative live pages manually and confirm there is no stronger conflicting signal that changes the intended SEO outcome.
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall