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). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). 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.

Hreflang

12,412 sites Security covered
View on drupal.org

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.

Activity

Total releases
2
First release
Dec 2024
Latest release
10 months ago
Releases (12 mo)
1
Maintenance
Active

Releases

Version Type Release date
8.x-1.16 Stable Sep 16, 2025
8.x-1.15 Stable Dec 8, 2024