Skip to Content

No content-language declaration

What Is This Issue

This issue checks whether your web pages have a properly declared Content-Language signal, either via the HTTP Content-Language response header or the deprecated <meta http-equiv="content-language"> HTML meta tag.

A passing implementation includes:

  • An HTTP Content-Language response header (preferred method)
  • OR a valid <meta http-equiv="content-language" content="xx"> tag in the <head> section
  • The language value should be a valid BCP 47 language tag (e.g., en, en-US, fr)
  • The value should be consistent with the <html lang> attribute

Example of correct implementation (HTTP header):

Content-Language: en-US

Example of correct implementation (HTML meta, deprecated but still used):

<meta http-equiv="content-language" content="en-US" />

Without this declaration, search engines may have weaker language targeting signals, especially for multilingual sites.

Why Is This Important

The Content-Language declaration helps search engines understand your content’s language:

  • Indexability: Search engines use language signals to serve the correct language version of your pages to users in different regions.
  • Duplicate content: Proper language declarations help search engines understand that translated content is not duplicate content, but alternate language versions.
  • International SEO: For multilingual websites, consistent language signals across HTTP headers, HTML attributes, and meta tags strengthen international SEO efforts.
  • AI Search / AEO: AI-powered search systems need to understand content language to provide accurate answers to users in their preferred language.

Resolving this issue improves your SEO health score by strengthening language targeting signals, which is particularly important for multilingual websites and international SEO.

How XeoPix Detects This

XeoPix performs the following checks to detect this issue:

  1. HTTP header check: The crawler examines the HTTP Content-Language response header from the page request.

  2. Meta tag search: It looks for a <meta> tag with the attribute http-equiv="content-language" in the <head> section.

  3. Value resolution: XeoPix determines the effective value:

    • HTTP headers take precedence over HTML meta tags
    • If both are present, the HTTP header value is used
    • If neither is present, the value is considered missing
  4. Validation: If a value is found, XeoPix:

    • Validates it against BCP 47 language tag format
    • Compares it to the <html lang> attribute value (from issue-105)
    • Checks for conflicts between the two
  5. Deprecation warning: The crawler flags if the deprecated <meta http-equiv="content-language"> method is used instead of the HTTP header.

  6. Pass/Fail determination:

    • Passes: If a valid Content-Language declaration exists (HTTP header or meta tag) and is consistent with the <html lang> attribute
    • Fails: If no declaration exists, the value is invalid, or it conflicts with the <html lang> attribute

The detection focuses on whether a valid language declaration exists and is consistent across different methods, not on whether the specific language matches the content (though mismatches may be flagged as warnings).

How To Fix

Follow these steps to implement the Content-Language declaration correctly:

  1. Choose your method (HTTP header is preferred over HTML meta):

    Method 1: HTTP Header (Recommended)

    • Configure your web server to send the Content-Language HTTP header
    • Example for Apache (.htaccess):
      Header set Content-Language "en-US"
    • Example for Nginx:
      add_header Content-Language "en-US";

    Method 2: HTML Meta Tag (Deprecated but acceptable)

    • Add the meta tag to your HTML <head> section:
      <meta http-equiv="content-language" content="en-US" />
    • Note: This method is deprecated in HTML5. The HTTP header or <html lang> attribute are preferred.
  2. Use valid BCP 47 language tags: Refer to the IANA Language Subtag Registry  for valid language tags.

  3. Ensure consistency: Make sure the Content-Language value matches:

    • The <html lang> attribute value
    • The actual language of the page content
  4. For multilingual sites: Ensure each page declares the correct language for its content.

  5. Verify implementation:

    • Use browser developer tools to check HTTP response headers
    • Use the W3C Markup Validation Service to check HTML meta tags
    • Test with search engine tools to ensure language targeting works correctly

Note: The <html lang> attribute (covered in issue-105) is the primary method for declaring page language. Content-Language provides additional signals but should be consistent with lang.

What We Store

Storage Level

Page Level — This issue is evaluated for each individual URL.


Database Table / Prisma Model

PageHtmlHeadAudit


Stored Fields

FieldTypeDescription
contentLanguageValueString?The content attribute of the content-language meta tag

Detection Dependencies

  • The following data sources are required to evaluate this issue:
  • HTML Document — The crawler parses the HTML head section to find the content-language meta tag
  • Meta Tag Extraction — The <meta http-equiv="content-language"> or <meta name="language"> tag is extracted

Examples

Example 1: Correct Implementation with HTTP Header

Scenario: A properly configured page with Content-Language HTTP header.

Correct State (Passes):

HTTP/1.1 200 OK Content-Type: text/html; charset=UTF-8 Content-Language: en-US ...
<html lang="en-US"> <head> <meta charset="UTF-8" /> <title>English US Page</title> </head> <body> <p>Content in American English.</p> </body> </html>

Example 2: Missing Content-Language Declaration

Scenario: Page has no Content-Language declaration.

Problematic State (Fails):

<html lang="en"> <head> <meta charset="UTF-8" /> <title>Page Title</title> </head> <body> <p>Content without Content-Language declaration.</p> </body> </html>

Why it fails: Without Content-Language, search engines may have weaker language targeting signals.

Corrected State (Passes):

  • Add Content-Language: en HTTP header
  • Or add <meta http-equiv="content-language" content="en"> (though HTTP header is preferred)

Example 3: Conflicting Language Declarations

Scenario: Content-Language header conflicts with html lang attribute.

Problematic State (Fails):

HTTP/1.1 200 OK Content-Language: fr ...
<html lang="en"> <head> <meta charset="UTF-8" /> <title>Page Title</title> </head> <body> <p>Content in English but header says French.</p> </body> </html>

Why it fails: Conflicting language signals confuse search engines.

Corrected State (Passes):

HTTP/1.1 200 OK Content-Language: en ...
<html lang="en"> <head> <meta charset="UTF-8" /> <title>Page Title</title> </head> <body> <p>Content in English with consistent language declarations.</p> </body> </html>

Example 4: Using Deprecated Meta Tag Method

Scenario: Page uses deprecated meta tag instead of HTTP header.

Problematic State (Warning):

<html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="content-language" content="en" /> <title>Page Title</title> </head> <body> <p>Content using deprecated meta tag method.</p> </body> </html>

Why it’s problematic: The meta tag method is deprecated in HTML5.

Corrected State (Passes):

  • Remove the meta tag
  • Add Content-Language: en as an HTTP response header
  • Keep <html lang="en"> as the primary in-document declaration

Unit Test

Test File

__tests__/seo-audit-checks/htmlHeadTags/issue-110-meta-http-equiv.test.js

Purpose

Validates the detection of <meta http-equiv> tags in the HTML <head>. Ensures pages are flagged when any http-equiv meta tags are present, and captures their httpEquiv and content attributes for reporting.

Tested Function

runHtmlHeadTags() from toggleGroups/htmlHeadTags.js

Issue Information

  • Issue Number: 110
  • Issue Code: META_HTTP_EQUIV
  • Toggle Group: htmlHeadTags

Test Scenarios

Positive Test Cases

  • Page has no http-equiv meta tags — no issue reported

Negative Test Cases

  • Page has <meta http-equiv="content-type" content="text/html; charset=UTF-8"> — issue reported with httpEquivTags array containing the tag
  • Page has multiple http-equiv meta tags (content-type and X-UA-Compatible) — issue reported with httpEquivTags.length equal to 2
  • Page has <meta http-equiv="refresh" content="5; url=https://example.com"> — issue reported with httpEquiv[0].httpEquiv equal to "refresh" and content equal to "5; url=https://example.com"
  • Page has http-equiv with different case (CONTENT-TYPE) — issue reported
  • Page has http-equiv with empty content (pragma) — issue reported with content equal to ""

Boundary Cases

None present.

Edge Cases

  • Empty HTML (<html></html>): no issue reported (no http-equiv tags present)
  • Malformed HTML: function handles without crashing; correctly detects http-equiv tags when present
  • Case-insensitivity: http-equiv values are matched regardless of case
  • Empty content: http-equiv tags with empty content are still detected
  • Multiple tags: multiple http-equiv tags are all captured in the details array

Expected Outcome

Pass

The issue should be reported when:

  • Any <meta http-equiv> tag is present in the HTML
  • Multiple http-equiv tags are present

Fail

The issue should not be reported when:

  • No http-equiv meta tags exist in the document
  • The HTML is empty (no head section)

Validation

  • Correct detection of http-equiv meta tags
  • Correct capture of httpEquiv and content attribute values
  • Correct handling of multiple http-equiv tags
  • Graceful handling of malformed HTML
  • Case-insensitive http-equiv detection
  • Cache mechanism prevents duplicate issue entries on repeated calls
  • toggleGroups/htmlHeadTags.js
  • issueCodes.js

Coverage Summary

  • Positive cases: 1 (no http-equiv tags)
  • Negative cases: 5 (single tag, multiple tags, refresh tag, different case, empty content)
  • Edge cases: 2 (empty HTML, malformed HTML)
  • Cache validation: 1

References

Last updated on