Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to specify language and country in hreflang #45

Open
kdambekalns opened this issue Dec 1, 2017 · 4 comments
Open

Allow to specify language and country in hreflang #45

kdambekalns opened this issue Dec 1, 2017 · 4 comments
Assignees

Comments

@kdambekalns
Copy link
Member

kdambekalns commented Dec 1, 2017

The hreflang value can specify a language (in ISO 639-1 format) and optionally the region (in ISO 3166-1 Alpha 2 format).

We "support" that, if the dimension used for generating alternate language links (defaults to language) is configured to use valid pairs already (if underscores are used, we replace with dashes):

  • de: German content, independent of region
  • en-GB: English content, for GB users
  • de-ES: German content, for users in Spain

If language and country are given separately, this needs some work. The same is true if values are used that do not conform to the ISO formats required.

@kdambekalns kdambekalns self-assigned this Dec 1, 2017
@kdambekalns
Copy link
Member Author

Given the freedom people have in naming their dimensions (in regards to both key and URI segment), the best is to document how this can be adjusted according to specific needs (it's actually rather simple.)

@Sebobo
Copy link
Member

Sebobo commented May 4, 2018

While working with SEO related stuff I also realized that it's not so great to not render the hreflang at all, when there are no dimensions. Text analyzers are working better if we give them at least a hint what language we have.

Also I didn't understand why the lang is not rendered when in non-live mode.

So I agree that we should at least have some documentation and maybe change the single language behavior.

@andreas83
Copy link

any news on this subject?

one of my clients asked me if it's possible to render the href tag for any dimension (language and country)
to me it looks like only the language for current country dimension is rendered by default.
any hints are highly appreciated.

Neos:
  Neos:
    userInterface:
      defaultLanguage: 'de'
      translation:
        autoInclude:
          Bloom.Site: ['Main', 'Form', 'NodeTypes/*']
  Flow:
    i18n:
      defaultLocale: 'de'
      fallbackRule:
        order: ['en', 'de']
  ContentRepository:
    contentDimensions:
      language:
        label: 'Sprache'
        icon: 'fas fa-language'
        default: 'en'
        defaultPreset: 'en'
        presets:
          en:
            label: 'English'
            values: ['en']
            uriSegment: 'en'
          de:
            label: 'Deutsch'
            values: ['de', 'en']
            uriSegment: 'de'
          es:
            label: 'Español'
            values: ['es', 'en']
            uriSegment: 'es'
          it:
            label: 'Italian'
            values: ['it', 'en']
            uriSegment: 'it'
          fr:
            label: 'French'
            values: [ 'fr', 'en' ]
            uriSegment: 'fr'
      country:
        label: 'Land'
        icon: 'fas fa-globe'
        default: 'GLOBAL'
        defaultPreset: 'GLOBAL'
        presets:
          GLOBAL:
            label: 'Global'
            values: ['GLOBAL']
            uriSegment: ''
          AT:
            label: 'Austria'
            values: ['AT', 'GLOBAL']
            uriSegment: 'AT'
            constraints:
              language:
                '*': false
                de: true
                en: true
          CH:
            label: 'Switzerland'
            values: ['CH', 'GLOBAL']
            uriSegment: 'CH'
            constraints:
              language:
                '*': false
                de: true
                en: true
                it: true
                fr: true
          DE:
            label: 'Germany'
            values: ['DE', 'GLOBAL']
            uriSegment: 'DE'
            constraints:
              language:
                '*': false
                de: true
                en: true
              
          ES:
            label: 'Spain'
            values: ['ES', 'GLOBAL']
            uriSegment: 'ES'
            constraints:
              language:
                '*': false
                es: true
                en: true
          GB:
            label: 'Great Britain'
            values: ['GB', 'GLOBAL']
            uriSegment: 'GB'
            constraints:
              language:
                '*': false
                en: true
          IT:
            label: 'Italy'
            values: ['IT', 'GLOBAL']
            uriSegment: 'IT'
            constraints:
              language:
                '*': false
                it: true
                en: true
          US:
            label: 'USA'
            values: ['US', 'GLOBAL']
            uriSegment: 'US'
            constraints:
              language:
                '*': false
                en: true
                es: true
          FR:
            label: 'France'
            values: [ 'FR', 'GLOBAL' ]
            uriSegment: 'FR'
            constraints:
              language:
                '*': false
                fr: true
                en: true







@Sebobo
Copy link
Member

Sebobo commented Oct 13, 2021

Hi @andreas83,

which feature do you mean, the Neos.Seo:LangAttribute or the HrefLang tags?

In each case the generation of the identifier can be overriden in your project with Fusion.

It's just hard to anticipate how people name their dimensions and what values they put in there, so I'm a bit unsure how to provide a default that would fit most projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants