To reproduce: start with a clean D8 beta3 install,
- Enable the Configuration translation and Language modules.
- Enable 3 languages - I picked English, Swedish and Arabic
- Don't enable any language detection methods. Ideally the interface should provide the option to simply match the node body content but that option is sadly missing and a separate issue..
- In the Content language settings make "Content" translatable and tick all boxes under article and basic page.
- Now create an article in english and give it a unique alias. Mine was titled "Drupal is the best thing since sliced bread". With the url alias "breaden"
- Use the translate tab to make 2 translations of this into swedish and arabic and give them aliases "breadsv" and "breadar"
Everything looks like it should be fine but only the english version is reachable. The links to breadsv and breadar in the english page header below give 404 not found errors:
<link rel="alternate" hreflang="en" href="http://hub:8089/breaden" />
<link rel="alternate" hreflang="sv" href="http://hub:8089/breadsv" />
<link rel="alternate" hreflang="ar" href="http://hub:8089/breadar" />
The bug is that these alternate links in the page head are correct, but could be better.., and should work but don't.
The alternate link to the english version shouldn't be there at all by the way. These links should really have titles and be part of the http headers as well.
I have a similar situation in d7 that I work around with code in the theme template.
https://www.drupal.org/node/2382467
Comments
Comment #1
iliphil commentedComment #2
iliphil commentedComment #3
iliphil commentedComment #4
catchComment #5
djevans commentedI've tried to reproduce this on 8.0.x-dev (see attached test case).
The links in the page header appear like this:
Regarding the links themselves, according to Google (Use hreflang for language and regional URLs):
So it looks like we shouldn't get rid of the link for the current language.
Comment #6
djevans commentedTrying again with an actual patch. :)
Comment #7
legolasboLet's set this to needs review so testbot can have a look at the patch.
Comment #8
iliphil commentedDJevans is right about the links - the link for the current language should stay. What the test patch is not doing is removing the default interface language detection so my original description of the bug should read "disable" rather than "don't enable". The use case for doing this is simply that when migrating existing translated content to Drupal then you should be able to use your existing urls rather than being forced into a url scheme with the language and the locale in the url. The inferface appears to let me do this - in the "Detection and selection" I can uncheck the boxes (except for the last one - Language based on a selected language)and create translations with arbitrary urls but the translations are unreachable.
Here it is not working (b15):
http://drupaldev.independentliving.org/bread
the html header from that page:
http://drupaldev.independentliving.org/brod
Page not found
The requested page could not be found.
http://drupaldev.independentliving.org/pan
Page not found
The requested page could not be found.
Comment #9
legolasbo@Iliphil,
Could you provide the steps to reproduce this on a vanilla installation of head?
Comment #10
iliphil commentedThe steps are essentially the same as djevans described with one additional step
The page head will then look like this, but only one of the links will work - the other two will be 404s.
Comment #11
plachIf this concerns only alternate href links then it does not look major...
Comment #12
plachAlso, the test-only patch is not failing so this clearly needs work :)
Comment #13
plachme--
Comment #19
raphaeltbm commentedI doesn't seems to be related to the alternate links in the head if it's a problem of URL access. I close it because, not reproducible and pretty outdated now. Feel free to open again if needed.