Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). Varbase Media Header 9.2.1 Minor update available for module varbase_media_header (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module allows you to set the language attribute for your website's HTML tag on a per-page or global basis. This helps improve SEO and accessibility by ensuring the language declared in the HTML matches the content of each page, even if you aren't using Drupal's full multilingual features. You can configure a default language for the entire site and override it for specific pages or content.

The HTML Lang Override module allows site administrators to explicitly define the lang attribute of the tag on a per-page basis or globally across the site.

  • This is particularly useful for websites that:
  • Do not use Drupal's multilingual system.
  • Contain only a few pages in languages other than the default.
  • Require precise control over the HTML lang attribute for SEO or accessibility compliance.

By default, Drupal sets the HTML lang attribute based on the site’s configured language. However, when a specific page is written in a different language and this is not reflected in the HTML lang tag, it can lead to SEO issues—especially when using hreflang meta tags. This module addresses that by letting you override the language code globally or on individual pages.

Features

  • Set a global default for the HTML lang attribute across all pages.
  • Override the HTML lang attribute for individual nodes (via the node edit form).
  • Define per-page language settings by path, including views and custom routes.
  • Helps resolve SEO warnings related to mismatched language codes in hreflang URLs and the HTML document.

Post-Installation

After installing the module:

  • A configuration form is available under admin configuration for setting a global language code and per-path language overrides.
  • A new field is added to the “Advanced” section of the node edit form, allowing editors to specify a language code for that specific node.
  • The default global language is initialized based on the site’s current default language.

Additional Requirements

No additional modules are required. This project works with Drupal Core only.

Activity

Total releases
9
First release
May 2025
Latest release
7 months ago
Releases (12 mo)
3 ▼ from 6
Maintenance
Slowing

Release Timeline

Releases

Version Type Release date
1.0.7 Stable Dec 1, 2025
1.0.6 Stable Dec 1, 2025
1.0.5 Stable Aug 28, 2025
1.0.4 Stable May 27, 2025
1.0.3 Stable May 26, 2025
1.0.2 Stable May 24, 2025
1.0.1 Stable May 23, 2025
1.0.x-dev Dev May 22, 2025
1.0.0 Stable May 22, 2025