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

Hreflang on non-canonical content pages

$
0
0

Problem/Motivation

When Content Translation module adds hreflang link tags to an entity page that is not the canonical URL, e.g. when query arguments are present, the page no longer has the self-referencing hreflang tag that is expected by search engines. I.e. the query string is expected to be appended to the href attribute URL.

Steps to reproduce

I have the node page, which renders a view listing with facets.
When some facet is applied, the canonical is pointed to the original node page.
Hreflang also points to the original node page, it cause the error "No self-referencing hreflang".

Proposed resolution

Option A: Add query arguments to the hreflang link tags, and add query arguments to the cache context. This allows the dynamic page cache to set a unique cache for each set of query arguments.

Option B: To improve cache efficiency, use lazy builder placeholders to add query arguments to the hreflang link tags. At present, HtmlResponseAttachmentsProcessor::processHtmlHeadLink() doesn't really contemplate this; it uses 'html_head_link:...' identifiers (that contain the href attribute) to merge duplicate link tags.

Remaining tasks

Choose one of the proposed solutions. The current patch #14 is Option A (adding cache context); however it seems like a good idea to develop an Option B patch that instead uses lazy builder placeholders for better cache efficiency?

User interface changes

None

API changes

Possibly a sort-of minor API change if link tags use lazy builder placeholders.

Data model changes

None


Viewing all articles
Browse latest Browse all 291320

Trending Articles



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