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 formatlanguage_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:
- Fetching the page HTML after following all redirects
- Parsing the
<head>section to extract the meta tag withproperty="og:locale" - Validating presence: Checks that the
og:localetag exists - Validating format: Ensures the value matches the expected
language_TERRITORYformat - 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
-
Add the
og:localetag 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
- Use the format
-
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
-
For multi-language sites:
- Set
og:localeto the primary language/region of each specific page - Consider using
og:locale:alternatefor additional language versions
- Set
-
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
| Field | Type | Description |
|---|---|---|
| ogLocale | String? | 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:localeis present (e.g.,en_US) → no issue detected.
Negative Test Cases
og:localeis 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:localetag. - Does not report a false positive when
og:localeis present. - Handles empty HTML gracefully without crashing.
Related Production Files
xeopix-crawling-v2/toggleGroups/socialOpenGraph.jsxeopix-crawling-v2/issueCodes.js
Coverage Summary
- Covers present and missing
og:localescenarios. - Includes resilience test for empty input.
References
- Open Graph Protocol - Locale — Open Graph Protocol
- ISO 639-1 Language Codes — Wikipedia
- ISO 3166-1 alpha-2 Country Codes — Wikipedia