Page MenuHomePhabricator

hreflang Tags' alternate URLs are not fully-qualified
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce:

What happens?:
hreflang Tags' alternate URLs are not fully-qualified
<link rel="alternate" hreflang="zh" href="/zh/Wikipedia:%E9%A6%96%E9%A1%B5">

What should have happened instead?:
hreflang Tags' alternate URLs should be fully-qualified
<link rel="alternate" hreflang="zh" href="https://zh.wikipedia.org/zh/Wikipedia:%E9%A6%96%E9%A1%B5">

Why it matters:

  • Search Engine like Google requires the hreflang tag to be fully-qualified. See here for details.
  • If you use the hreflang Tags testing tool, the hreflang on Chinese Wikipedia are not following the standard, making the tags in the HTML codes useless.

QA Results - Beta

ACStatusDetails
1T294716#8559537

QA Results - Prod

ACStatusDetails
1T294716#8567007

Event Timeline

Restricted Application added subscribers: Stang, Aklapper. · View Herald Transcript

Change 735753 had a related patch set uploaded (by VulpesVulpes825; author: Junyin Chen):

[mediawiki/core@master] Make sure hreflang Tags' alternate URLs are fully-qualified

https://gerrit.wikimedia.org/r/735753

thcipriani subscribed.

(moving to not a blocker for now since it's been a bug for a long time, but it would be nice to have)

Untagging, not related to ResourceLoader.

Hi folks, this has been staled for a while. Any chance we can push this forward a bit?

I'm daily wiki users and a programmer from Taiwan. Would love to see SEO of wiki chinese sites work smoothly. Happy to help out!

@YLJ: Anyone is welcome to amend the proposed patch in https://gerrit.wikimedia.org/r/c/mediawiki/core/+/735753/ - thanks in advance!

I'd like to help, but I'm not a member of the Trusted-Contributors group on Gerrit, would you mind adding me to the group?

Jdlrobson added a project: Web-Team-Backlog.
Jdlrobson subscribed.

This has been flagged as something really important to fix. Web team will make sure this gets done.

Jdlrobson moved this task from Incoming to Code Review on the Web-Team FY2022-23 Q3 Sprint 1 board.

The patch looks fine to me, but I've asked for clarity on the ticket if anything is blocking it with an aim to merge it Monday.

Test wiki created on Patch demo by Winston Sung using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/32d87a158c/wiki/Main Page

Test wiki on Patch demo by Winston Sung using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/32d87a158c/w/

Change 735753 merged by jenkins-bot:

[mediawiki/core@master] Make sure hreflang Tags' alternate URLs are fully-qualified

https://gerrit.wikimedia.org/r/735753

Change 879579 had a related patch set uploaded (by Winston Sung; author: Winston Sung):

[mediawiki/core@master] Fix the behavior for language variants for meta canonical and alternate

https://gerrit.wikimedia.org/r/879579

Edtadros subscribed.

@Jdlrobson is there a page on beta were this can be verified?

Is there a page on beta were this can be verified?

It should already be available on beta Wikipedia-zh:

https://zh.wikipedia.beta.wmflabs.org/wiki/

Is there a page on beta were this can be verified?

It should already be available on beta Wikipedia-zh:

https://zh.wikipedia.beta.wmflabs.org/wiki/

Thanks!

Test Result - Beta

Status: ✅ PASS
Environment: zhbeta
OS: macOS Ventura
Browser: Chrome
Device: MBP
Emulated Device:NA

Test Artifact(s):

QA Steps

List of steps to reproduce:

Check the heading of HTML code for any page which its content language has variants (For example, homepage of Chinese Wikipedia)
✅ AC1: hreflang Tags' alternate URLs should be fully-qualified

Screenshot 2023-01-25 at 5.32.26 PM.png (892×1 px, 460 KB)

Test Result - Prod

Status: ✅ PASS
Environment: zhwiki
OS: macOS Ventura
Browser: Chrome
Device: MBP
Emulated Device:NA

Test Artifact(s):

QA Steps

List of steps to reproduce:

Check the heading of HTML code for any page which its content language has variants (For example, homepage of Chinese Wikipedia)
✅ AC1: hreflang Tags' alternate URLs should be fully-qualified

Screenshot 2023-01-28 at 4.56.09 PM.png (1×1 px, 656 KB)

Jdlrobson closed this task as Resolved.EditedFeb 6 2023, 10:23 PM

On :https://zh.m.wikipedia.org/zh/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC the hreflang Tags' alternate URLs previously looked like:

<link rel="alternate" hreflang="zh" href="/zh/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>
<link rel="alternate" hreflang="zh-Hans" href="/zh-hans/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>
<link rel="alternate" hreflang="zh-Hant" href="/zh-hant/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>
<link rel="alternate" hreflang="zh-Hans-CN" href="/zh-cn/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>
<link rel="alternate" hreflang="zh-Hant-HK" href="/zh-hk/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>
<link rel="alternate" hreflang="zh-Hant-MO" href="/zh-mo/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>
<link rel="alternate" hreflang="zh-Hans-MY" href="/zh-my/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>
<link rel="alternate" hreflang="zh-Hans-SG" href="/zh-sg/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>
<link rel="alternate" hreflang="zh-Hant-TW" href="/zh-tw/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>

They now look like:

<link rel="alternate" hreflang="zh" href="https://zh.wikipedia.org/zh/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>
<link rel="alternate" hreflang="zh-Hans" href="https://zh.wikipedia.org/zh-hans/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>
<link rel="alternate" hreflang="zh-Hant" href="https://zh.wikipedia.org/zh-hant/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>
<link rel="alternate" hreflang="zh-Hans-CN" href="https://zh.wikipedia.org/zh-cn/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>
<link rel="alternate" hreflang="zh-Hant-HK" href="https://zh.wikipedia.org/zh-hk/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>
<link rel="alternate" hreflang="zh-Hant-MO" href="https://zh.wikipedia.org/zh-mo/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>
<link rel="alternate" hreflang="zh-Hans-MY" href="https://zh.wikipedia.org/zh-my/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>
<link rel="alternate" hreflang="zh-Hans-SG" href="https://zh.wikipedia.org/zh-sg/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>
<link rel="alternate" hreflang="zh-Hant-TW" href="https://zh.wikipedia.org/zh-tw/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>
<link rel="alternate" hreflang="x-default" href="https://zh.wikipedia.org/wiki/%E6%9F%A5%E7%90%86%C2%B7%E8%8A%92%E6%A0%BC"/>
`

I'm going to follow up to find out how important it is to do T328209 (include the mobile domain) and T54429 (canonical URLs do not include the language variant).