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

Remove hreflang from a tag in widget #1088

Merged
merged 1 commit into from
May 8, 2022
Merged

Conversation

Komarovski
Copy link
Contributor

There's no need to set hreflang in "a" tag, since we have "link" tags with hreflang in "head" of the website.

I have digged all around the network and didn't find any information about using hreflang attribute inside of "a" tags.

There's no need to set hreflang in "a" tag, since we have "link" tags with hreflang in "head" of the website.

I have digged all around the network and didn't find any information about using hreflang attribute inside of "a" tags.
@herrvigg
Copy link
Collaborator

herrvigg commented Dec 5, 2021

It's true that we mostly count on the link tag for this but I'm not sure about the a tag. I didn't dig much, this page might not be the best reference, but here hreflang is mentioned in the a tag: https://www.w3schools.com/tags/att_a_hreflang.asp. If we are really sure it's not needed then yes we can remove it.

@Komarovski
Copy link
Contributor Author

It's true that we mostly count on the link tag for this but I'm not sure about the a tag. I didn't dig much, this page might not be the best reference, but here hreflang is mentioned in the a tag: https://www.w3schools.com/tags/att_a_hreflang.asp. If we are really sure it's not needed then yes we can remove it.

Sorry, yep, I have also found information (not official), that hreflang can be used in "a" tags. But here is another issue that we can fix by removing hreflang from "a" tags. Here is the situation:

For example, we have website with two languages "English (default)" and "Russian", plus we have "Pre-Path Mode" and "hide_default_language" is enabled. The output for "link" tags will look like:

<link hreflang="en" href="https://example.com/" rel="alternate">
<link hreflang="ru" href="https://example.com/ru/" rel="alternate">

Which is right, but in widget we will have another link for default language:

<a href="https://example.com/en/" hreflang="en" ***><span>English</span></a>
<a href="https://example.com/ru/" hreflang="ru" ***><span>Russian</span></a>

So "link" and "a" tags will point to different URLs "https://example.com/" and "https://example.com/en/" for same page.

@herrvigg herrvigg changed the title Update qtranslate_widget.php Remove hreflang from a tag in widget Dec 6, 2021
@herrvigg herrvigg added the core Core functionalities, including the admin section label Dec 6, 2021
@herrvigg herrvigg force-pushed the master branch 2 times, most recently from 660b9d6 to 2369434 Compare February 19, 2022 23:14
Copy link
Collaborator

@herrvigg herrvigg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK let's remove this from the a tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core functionalities, including the admin section
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants