Metatag_hreflang - duplicate alternate hreflang meta

Created on 21 August 2018, almost 6 years ago
Updated 14 June 2023, about 1 year ago

When the module metatag_hreflang is enabled and then you filled the new alternate hreflang fields in the metatag config UI with whatever values (hardpath, tokens, ...).
The alternate href meta in <head> generated by content_translation module from drupal core (@see function content_translation_page_attachments) are not removed. So you have duplicate alternate hreflang meta, both from metatag_hreflang and content_translation.

Let suppose that when this module is enabled, there is a will to manage fully these meta via the UI, and so the alternate hreflang generated by content_translation just removed in favor of what metatag_hreflang defines or not (if you don't want alternate hreflang for some kind of pages), no condition checking, no override, ... ?

- To be plainly useful, at the minimum, it should be possible to use language aware tokens (@see #2956982-4: Port hreflang tokens to D8 β†’ ).

- This module should maybe have dependencies with language and content_translation modules?

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Multilingual/intl

Created by

πŸ‡«πŸ‡·France raphaeltbm

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ͺπŸ‡¬Egypt omnia.ibrahim

    I got an error in line 40:
    if (strpos($element[1], 'hreflang_per_language') !== FALSE &&

    when using:

    $attachments['#attached']['html_head'][] = [
    [
    '#tag' => 'meta',
    '#attributes' => [
    'name'=> 'key',
    'content' => '3344',
    ],
    ],

Production build 0.69.0 2024