Skip to Content

No og:locale tag

What Is This Issue

The og:locale meta tag specifies the locale (language and region) of your web page content. This helps social platforms display your content correctly to users in different regions and languages.

This issue checks whether your page has the og:locale tag implemented. A passing implementation must include:

  • og:locale - The locale in the format language_TERRITORY (e.g., en_US, fr_FR, de_DE)

Example of passing implementation:

<meta property="og:locale" content="en_US" />

Why Is This Important

The og:locale tag is important for international audiences and social media sharing:

  • Correct regional formatting: Ensures dates, numbers, and currencies display correctly
  • Language targeting: Helps social platforms show content to users in the correct language
  • Regional sharing: Content shared in different regions will display with appropriate localization
  • AI Search / AEO: AI systems use locale information to understand content targeting
  • User experience: Users see content formatted according to their regional expectations

Without the og:locale tag, social platforms may:

  • Display content with incorrect regional formatting
  • Misinterpret the language or region of your content
  • Show content to inappropriate audiences

Resolving this issue improves international social media sharing and contributes to a higher overall SEO health score by ensuring proper content localization.

How XeoPix Detects This

XeoPix checks for the og:locale tag by:

  1. Fetching the page HTML after following all redirects
  2. Parsing the <head> section to extract the meta tag with property="og:locale"
  3. Validating presence: Checks that the og:locale tag exists
  4. Validating format: Ensures the value matches the expected language_TERRITORY format
  5. Flagging the issue if the tag is missing or contains an invalid format

The detection is performed on the raw HTML response without JavaScript execution, matching how social media crawlers see your pages.

How To Fix

  1. Add the og:locale tag to your HTML <head> section:

    • Use the format language_TERRITORY (lowercase language code, underscore, uppercase territory code)
    • Common examples: en_US, en_GB, fr_FR, de_DE, es_ES, ja_JP
  2. Choose the correct locale:

    • Match the primary language and region of your page content
    • Use ISO 639-1 language codes and ISO 3166-1 alpha-2 country codes
  3. For multi-language sites:

    • Set og:locale to the primary language/region of each specific page
    • Consider using og:locale:alternate for additional language versions
  4. Test your implementation:

    • Use Facebook Sharing Debugger to verify locale is detected
    • Check that content displays correctly when shared in different regions

What We Store

Storage Level

Page Level


Database Table / Prisma Model

SocialOpenGraphData


Stored Fields

FieldTypeDescription
ogLocaleString?Open Graph locale property (og:locale)

Detection Dependencies

  • HTML Document
  • Meta Tags (og:locale)

Examples

Example 1: Missing OG Locale

Problematic state (what fails):

<meta property="og:title" content="My Page" /> <!-- Missing og:locale tag -->

Corrected state (what passes):

<meta property="og:title" content="My Page" /> <meta property="og:locale" content="en_US" />

Example 2: Incorrect Locale Format

Problematic state (what fails):

<meta property="og:locale" content="english-United States" /> <!-- Incorrect format -->

Corrected state (what passes):

<meta property="og:locale" content="en_US" /> <!-- Correct ISO format -->

Example 3: Multi-language Site

Corrected state (what passes):

<meta property="og:locale" content="en_US" /> <meta property="og:locale:alternate" content="fr_FR" /> <meta property="og:locale:alternate" content="es_ES" /> <!-- Primary locale with alternatives -->

Unit Test

Test File

xeopix-crawling-v2/__tests__/seo-audit-checks/socialOpenGraph/issue-120-og-locale-set.test.js

Purpose

Validates that the crawler detects pages missing the og:locale Open Graph meta tag.

Tested Function

runSocialOpenGraph()

Issue Information

  • Issue Number: 120
  • Issue Code: og_locale_set
  • Toggle Group: socialOpenGraph

Test Scenarios

Positive Test Cases

  • og:locale is present (e.g., en_US) → no issue detected.

Negative Test Cases

  • og:locale is missing from the page → issue detected with message "Open Graph locale tag is missing".

Boundary Cases

No boundary cases exist in the test.

Edge Cases

  • Empty HTML: The function handles an empty string without throwing.

Expected Outcome

Pass

The issue should not be reported when the og:locale meta tag is present in the page HTML.

Fail

The issue should be reported when the og:locale meta tag is missing.

Validation

  • Correctly detects the absence of the og:locale tag.
  • Does not report a false positive when og:locale is present.
  • Handles empty HTML gracefully without crashing.
  • xeopix-crawling-v2/toggleGroups/socialOpenGraph.js
  • xeopix-crawling-v2/issueCodes.js

Coverage Summary

  • Covers present and missing og:locale scenarios.
  • Includes resilience test for empty input.

References

Last updated on