Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

HTML Lang Attribute Override

14 sites No security coverage Drupal 9–11
View on drupal.org

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.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
9
Tracked since
May 2025
Latest release
8 months ago
Releases (12 mo)
2 ▼ from 7
Maintenance
Slowing

Release Timeline

Releases

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