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

hreflang links missing in header #13359

Closed
v912485 opened this issue Dec 23, 2016 · 19 comments
Closed

hreflang links missing in header #13359

v912485 opened this issue Dec 23, 2016 · 19 comments

Comments

@v912485
Copy link

v912485 commented Dec 23, 2016

Steps to reproduce the issue

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

Expected result

Alternate links are generated in the header of the page such as:
<link href="http://example.com/es/my-page" rel="alternate" hreflang="es" />

Actual result

These links are missing for the different languages

System information (as much as possible)

Joomla! 3.6.5 Stable

Additional comments

The hreflang links are generated fine for normal article pages.

@infograf768
Copy link
Member

Which component is that?

@v912485
Copy link
Author

v912485 commented Dec 23, 2016

BreezingForms, JComments and my own custom built components are the ones where I have noticed it so far.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13359.

@infograf768
Copy link
Member

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.

@infograf768
Copy link
Member

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?

@v912485
Copy link
Author

v912485 commented Dec 24, 2016

Given that it's now confirmed, do I still need to test with staging?
Yes, I also have sef enabled.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13359.

@infograf768
Copy link
Member

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.

@ghost
Copy link

ghost commented Feb 6, 2017

Issue also on latest 3.7-staging.

@ethernidee
Copy link
Contributor

ethernidee commented Jan 30, 2018

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.

@infograf768
Copy link
Member

Moving to trash or Deleting?

@infograf768
Copy link
Member

Also @ethernidee
Your issue has nothing to do with this one which deals with hreflang.

@ethernidee
Copy link
Contributor

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).

@infograf768
Copy link
Member

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.

@ethernidee
Copy link
Contributor

Did you try to unpublish/delete item with default site language and navigate to associated item in another language?

@infograf768
Copy link
Member

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)
screen shot 2018-02-02 at 09 36 30

Then, in frontend, I display Catégories(fr)
screen shot 2018-02-02 at 09 41 39

No hreflang
screen shot 2018-02-02 at 09 42 59

As home pages are associated by default I do get the hreflang there
screen shot 2018-02-02 at 09 44 49


But I found an error when there is no specific menu item and an associated category is unpublished.
That may be your case.
screen shot 2018-02-02 at 09 51 24

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

@infograf768
Copy link
Member

@andrepereiradasilva
Do you see a way to solve this issue.

@ethernidee
Copy link
Contributor

@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.

@infograf768
Copy link
Member

I am working on a patch.

@infograf768
Copy link
Member

Please test #19551

Closing as we have a PR

@infograf768
Copy link
Member

@ethernidee
Please test #19551

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

No branches or pull requests

4 participants