Have a multi-lingual installation with language filter installed and enabled
Install custom component
Create 2 menus for each language
Create a menu item for the component in each menu and set the appropriate language for the menu items
Associated the menu items of the two languages
Alternate links are generated in the header of the page such as:
<link href="http://example.com/es/my-page" rel="alternate" hreflang="es" />
These links are missing for the different languages
Joomla! 3.6.5 Stable
The hreflang links are generated fine for normal article pages.
BreezingForms, JComments and my own custom built components are the ones where I have noticed it so far.
Please install a test site with https://github.com/joomla/joomla-cms/archive/staging.zip
Install as multilang and then your components and test again.
Hmm, I confirm the issue with JComments when sef
is on when using staging.
$active_link
is NOT equal to $current_link
, therefore $associations
is not checked.
It works fine when sef is off.
@andrepereiradasilva
can you have a look at this please?
Given that it's now confirmed, do I still need to test with staging?
Yes, I also have sef enabled.
No need indeed to test in staging until we find a solution, if possible.
At this time I think that the issue is with the component itself (JComment in my tests)
I get here on a staging test site
'/sqltest/trunkgitnew/index.php/fr/comments-list-fr?view=comments'
for $active_link
and
'/sqltest/trunkgitnew/index.php/fr/comments-list-fr'
for $current_link
any core component gets these fine and equal
Example: a contact list categories gets
'/sqltest/trunkgitnew/index.php/fr/list-contacts-categories-fr'
for both variables.
Issue also on latest 3.7-staging.
Priority | Medium | ⇒ | Low |
Status | New | ⇒ | Confirmed |
Status | Confirmed | ⇒ | Discussion |
Having 3 menu items for different languages (all associated) is a problem, when you decide to unpublish/move to trash any item and even article/category for that item.
languagefilter inserts the following links:
<link href="https://domain.tld/?id=10" rel="alternate" hreflang="en-GB" />
?id=10 is category ID. Seems like only removing association at all helps in this case.
Moving to trash or Deleting?
Also @ethernidee
Your issue has nothing to do with this one which deals with hreflang.
I've tried unpublishing and moving to trash. Updated previous comment, parser consumed html link. Deleting association from both category and menu item works. Simple unpublishing/moving to trash does not work (still generates garbage hreflang and language switcher flag link).
I can't reproduce your issue. Testing on 3.8.4.
When an associated item is Unpublished or Trashed (not even deleted), the corresponding hreflang is not present in Source.
It still appears as Associated though in the manager until deleted.
Did you try to unpublish/delete item with default site language and navigate to associated item in another language?
Yes, for menu items, but see further as your case looks different.
Example here for a menu item
Categories_gb is unpublished but still associated to Catégories(fr)
Then, in frontend, I display Catégories(fr)
As home pages are associated by default I do get the hreflang there
But I found an error when there is no specific menu item and an associated category is unpublished.
That may be your case.
In that case I evidently get a 404 for the unpublished category and its articles when switching via the module (IN 3.8.4. This will be corrected in 3.8.5 by #19512 , BUT also a wrong hreflang when I display Catégorie (fr-fr)
<link href="http://localhost:8888/installmulti/trunkgitnew/fr/catégories-fr/9-categorie-fr-fr.html" rel="alternate" hreflang="fr-FR" />
<link href="http://localhost:8888/installmulti/trunkgitnew/en/component/content/category.html?id=8" rel="alternate" hreflang="en-GB" />
After merging #19512 I will get the same you had , i.e.
<link href="http://localhost:8888/installmulti/trunkgitnew/fr/catégories-fr/9-categorie-fr-fr.html" rel="alternate" hreflang="fr-FR" />
<link href="http://localhost:8888/installmulti/trunkgitnew/en/?id=8" rel="alternate" hreflang="en-GB" />
Therefore I confirm the bug for hreflang
@andrepereiradasilva
Do you see a way to solve this issue.
@infograf768, thanks for investigation.
I've tried creating 3 categories in different languages and three menu items for them, then unpublished/deleted to trash 1 category or 1 menu item, or category and item at the same time. Mainly, the one of default site language.
Let's say it's "News" with blog layout. Then whenever I navigate to any of the rest 2 menu items I see 3 hreflang with ?id=... for unpublished/removed one. Trying to access it gives 404.
Moreover, language switcher plugin displays 3 flags (it's ok) and link for default site language is the same as for hreflang.
I am working on a patch.
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-02-03 11:07:04 |
Closed_By | ⇒ | infograf768 |
@ethernidee
Please test #19551
Which component is that?