Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295102

drupal_add_html_head_link() needs to allow multiple hreflang tags to point to one URL.

$
0
0

Problem/Motivation

Per i18n, hreflang tags are allowed to have more then one translation point to the same link. However, using the core (includes/common.inc) drupal_add_html_head_link() function, this is not possible. Currently, drupal_add_html_head_link() function considers the same rel and href values to be duplicates and removes all but one, breaking attempts to add multiple hreflang links pointing to the same href.

See Google write-up of this i18n consideration for hreflang uniqueness: https://www.rebelytics.com/multiple-hreflang-tags-one-url/

Proposed resolution

Add hreflang value as part of the uniqueness check (if hreflang attribute is provided). Rather then just checking rel / href, a unique link tag would consider the 3 attribute values of rel / href / hreflang as a unique link.

API changes

Modify the drupal_add_html_head_link() function in includes/common.inc to included hreflang as part of it's check for a unique link tag in order to prevent removal of duplicate link tags that have different hreflang attribute values but the same rel/href attributes.


Viewing all articles
Browse latest Browse all 295102

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>