Issue Bug Closed

#94207Hreflang / Language Menu have a wrong fallback to the default language

Marc Hirdes 05/27/21, 09:44 updated 11/06/26, 08:45

Description

I have the following setup like in the core seo hreflang tests.

rootPageId: 1
base: http://localhost/
languages:
  - title: English
    enabled: true
    languageId: 0
    base: /
    typo3Language: default
    locale: en_US.UTF8
    iso-639-1: en
    navigationTitle: English
    hreflang: en-US
    direction: ltr
    flag: en-us-gb
    websiteTitle: ''
  - title: German
    enabled: true
    base: /de/
    typo3Language: de
    locale: de_DE.UTF8
    iso-639-1: de
    websiteTitle: ''
    navigationTitle: Deutsch
    hreflang: de-DE
    direction: ltr
    fallbackType: strict
    fallbacks: ''
    flag: de
    languageId: 1
  - title: 'Swiss German'
    enabled: true
    base: /de-ch/
    typo3Language: de
    locale: de_CH.UTF8
    iso-639-1: de
    websiteTitle: ''
    navigationTitle: Schweiz
    hreflang: de-CH
    direction: ltr
    fallbackType: fallback
    fallbacks: '1'
    flag: ch
    languageId: 2

So the language 2 points only to language 1 as fallback, not to the default language. When there is no translation given, I can not call the url /de-ch/ without an error. But in the language menu and hreflang this version is specified. Correct would be:
1. If there is no translation, don’t show any hreflang.
2. Specify the hreflang for language 2, if there is a translated record in lanuage 1 or language 2.

Reviews 1

History 4

  1. Riny van Tiggelen commented 09/08/21, 11:28

    Could you try if this fixes your issue (or at least the first)?
    https://review.typo3.org/c/Packages/TYPO3.CMS/+/69919

  2. Riny van Tiggelen changed status New Needs Feedback 09/08/21, 11:29

  3. Riccardo De Contardi commented 12/30/21, 09:33

    https://review.typo3.org/c/Packages/TYPO3.CMS/+/69919 has been merged AFAICS

    Is this issue still relevant?

  4. Benni Mack commented and changed status Needs Feedback Closed 11/06/26, 08:45

    This has been fixed with https://review.typo3.org/c/Packages/TYPO3.CMS/+/69919 and follow-ups. On current versions, a language whose fallback chain does not include the default language is only marked as available in the language menu, and only gets an hreflang tag, if the page (or a page in its fallback chain) is translated. HrefLangGeneratorTest covers exactly this setup (de-CH falling back to de). Closing — please reopen if you can still reproduce this on 13.4 or 14.