Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Hreflang

Security covered Under active development 12,466 sites

This module automatically adds hreflang tags to your Drupal site's pages, helping search engines serve the correct language or regional URL in search results. It works with your site's enabled languages and the language switch links provided by Drupal core, and can be configured to work alongside or override the core Content Translation module.

Search engines use <link rel="alternate" hreflang="" href=""> tags to serve the correct language or regional URL in search results.

Hreflang is a simple module that automatically adds these tags to your pages, based on your site's enabled languages and the language switch links provided by core.

More info about hreflang can be found at the article Use hreflang for language and regional URLs.

A few days after installing this module, you should see a message reading "Currently, your site has no hreflang tag errors" at Google Webmaster Tools.

Take a look at the source code of this site to see the module in action.

The core Content Translation module adds hreflang tags only on content entity pages. This module, on the other hand, adds hreflang tags to all pages, and can be configured to defer to Content Translation module on content entity pages. If for some reason you'd like to modify the hreflang tags on a page, you can do so by implementing hook_language_switch_links_alter() or hook_page_attachments_alter() in a site-specific custom module.

Drupal 7

This module has no dependencies, but works well with Entity Translation module. If for some reason you'd like to modify the hreflang tags on a page, you can do so by implementing hook_language_switch_links_alter() or hook_html_head_alter() in a site-specific custom module.

Credits:

This module is developed and maintained by mfb. You can support development by contributing or sponsoring.

Alternatives and similar modules:

The Metatag: Hreflang module allows tokens to be entered to set the hreflang tags, but doesn't do that (or anything) automatically. This module adds the hreflang tags automatically.

Ports:

This project has been ported to Backdrop CMS and Drupal 6 LTS.

Drupal 11 · not 10

Ask your assistant about Hreflang

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

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
8
Tracked since
Mar 2023
Latest release
1 month ago
Releases (12 mo)
2
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
2.0.0 Stable 11 Aug 17, 2026
2.x-dev Dev 11 Jul 19, 2026
8.x-1.16 Stable 8–11 Sep 16, 2025
8.x-1.15 Stable 8–11 Dec 8, 2024
8.x-1.14 Stable 8–11 PHP 7.1 May 22, 2024
8.x-1.13 Stable 8–10 PHP 7.1 Mar 28, 2024
8.x-1.12 Stable 8–10 PHP 7.1 Nov 2, 2023
8.x-1.11 Stable 8–10 PHP 7.1 Mar 16, 2023