Page MenuHomePhabricator

Make the Mobile site more discoverable by search engines
Closed, DeclinedPublic

Description

  • Add rel="alternate" for the "Mobile View" link (in the footer) in the head of the desktop site.
  • And vice versa, add rel="canonical" for the "Desktop" URL (in the footer) in the head of the mobile site.

For example, on http://en.wikipedia.org/wiki/Main_Page add <link rel="alternate" href="http://en.m.wikipedia.org/wiki/Main_Page">.

Developer notes

In T91183 such functionality was added by @Florian

Adding the following config

$wgMobileUrlTemplate = '%h0.m.%h1.%h2';
$wgMFNoindexPages = true;

will add a link tag to the document:

<link rel="alternate" media="only screen and (max-width: 720px)" href="">

Currently in production wgMFNoindexPages is false having been disabled by @MaxSem 5 years ago in Ia841ad77eacdf9b07222101f052e3c05f36dd02c. details there are slim (per discussion with google)

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
bmansurov raised the priority of this task from to Needs Triage.May 18 2015, 10:41 PM
bmansurov subscribed.

Change 212022 had a related patch set uploaded (by Florianschmidtwelzow):
Enable alternate and canonical links for mobile/desktop pages

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

Change 212021 had a related patch set uploaded (by Florianschmidtwelzow):
Hygiene: Correctly add alternate and canocial links

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

I'm not sure, if enabling it has any unexpected side effects :/ Mobile pages aren't blocked by robots.txt (i remember i read something like that), but i think @MaxSem had some reason to set $wgMFNoindexPages to false in https://gerrit.wikimedia.org/r/#/c/46542/ :)

Change 212021 merged by jenkins-bot:
Correctly add alternate and canocial links

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

I'm not really happy, that this is already marked as resolved, see my last comment :)

I'm not sure, if enabling it has any unexpected side effects :/ Mobile pages aren't blocked by robots.txt (i remember i read something like that), but i think @MaxSem had some reason to set $wgMFNoindexPages to false in https://gerrit.wikimedia.org/r/#/c/46542/ :)

It would be great, if we can discuss to enable this on wmf wikis :) (proposed in change https://gerrit.wikimedia.org/r/#/c/212022/)

@MaxSem can you comment?
@Florian I'll add it to the sprint board so this doesn't get lost and gets signed off and any bugs that need to be opened are.

phuedx subscribed.

Ping @MaxSem, @kaldari: Can you provide additional context for 46542 – why $wgMFNoIndexPages was set to false for a sample of articles?

Indexing of the mobile site was initially disabled due to Google screwups (mixing mobile results with desktop on desktop searches, etc). Enabling back for a subset was an attempt to check if it was fixed, as out Google contacts claimed.

Thanks for your feedback @MaxSem :) Hmm, what project do you suggest? Maybe a little wikipedia first (maybe and all others if that works like expected?

I would suggesting trying Wikivoyage? It's search rankings can only improve.. ! :)

@Florian: Do you think the use of Title#getFullURL avoids the problems tracked by T93550. I've taken a quick look at the source and it seems so, but there's a hook in there too…

@phuedx Hmm, I can't reproduce this problem for "our" canonical/alternate tag, I tested the following cases:
(mobile) /w/index.php?title=Main_Page
-> canonical tag with (desktop-url)/wiki/Main_Page

(mobile)/wikki/Main_Page
-> canonical tag with (desktop-url)/wiki/Main_Page

(desktop)/w/index.php?title=Main_Page
-> alternate tage with (mobile-url and max-width 768px)/wiki/Main_Page

(desktop)/wiki/Main_Page
-> alternate tage with (mobile-url and max-width 768px)/wiki/Main_Page

But it's possible that I have something somewhere in my local setup, so we probably should wait with changing anything in this direction until T93550 or at least T67402 is resolved, just to be sure :)

Btw.: I see, that we would add the alternate and canonical links for all actions, not just for view, so the edit page would have these tags, too, which sounds pretty false to me. Any input? :)

@Florian: How is this affected by the work in T67402 as well? It looks like the related patches give us canonical URL generation for free. One thing worth noting is that the inclusion of the canonical link is behind a feature flag in core, i.e. $wgEnableCanonicalServerLink, whereas in core it's something else.

Btw.: I see, that we would add the alternate and canonical links for all actions, not just for view, so the edit page would have these tags, too, which sounds pretty false to me. Any input? :)

I'm struggling to think of an action that this wouldn't be useful for.

@Florian: How is this affected by the work in T67402 as well? It looks like the related patches give us canonical URL generation for free. One thing worth noting is that the inclusion of the canonical link is behind a feature flag in core, i.e. $wgEnableCanonicalServerLink, whereas in core it's something else.

Hmmpf, I haven't tested yet, but we should avoid to to add multiple canonical links to one page. One way would be to check for the relevant config vars from core, before trying to add the canonical link (which should be always the desktop url), which doesn't cover cases, where no canonical link is added. Another way would be to force disable the core canonical link on all mobile pages and always add our own one (with a nearly same implementation as core), which we should avoid, too (code duplication isn't rellay good). Another, in my point of view much easier, way would be to use core to create a canonical tag on mobile pages. For this we (like I said: untested) we just need to force $wgEnableCanonicalServerLink to be true and set a canocial link with OutputPage::setCanonicalUrl(). I would upload a change for it, after i tested it but would appreciate some feedback :)

For the alternate: It doesn't affect us, MediaWiki core shouldn't add an alternate link for a mobile optimized version (it's all handled by MobileFrontend).

Btw.: I see, that we would add the alternate and canonical links for all actions, not just for view, so the edit page would have these tags, too, which sounds pretty false to me. Any input? :)

I'm struggling to think of an action that this wouldn't be useful for.

Yeah, core adds the canonical links to all actions, too, so never mind :)

@Florian Hey! what's the status of this? Patch is merged.

Jhernandez moved this task from Incoming to 2016-17 Q2 on the Web-Team-Backlog board.

@Jhernandez: There is still an open change (https://gerrit.wikimedia.org/r/#/c/212022/). For now, I would wait, until the blocked by task is resolved. Then test our own implementation again and decide, if there is something we need to do, or if we can test to enable it in one of the wmf wikis :)

Change 212022 abandoned by Florianschmidtwelzow:
Enable alternate and canonical links for mobile/desktop pages

Reason:
can be done later, too, it's just a small change, and there is some work that need to be done before this change.

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

Still not clear what is left to do here. @Florian could you clarify in the task description? :)

Moved to discovery team since this seems more inline with their remit.

Moved to discovery team since this seems more inline with their remit.

I'm not sure that it is. Part of the reason is that I'm unclear what problem this task is aimed at solving; the title of the task mentions a specific solution to an unclear problem.

@Florian Can you provide information on the problem that this task is intended to solve? I can't assess this task's priority at present.

@Deskana: I thought I had this explained already, but it seems, I haven't :P Let me try it now:

The goal should be to implement https://developers.google.com/webmasters/mobile-sites/mobile-seo/configurations/separate-urls for Wikimedia domains (mobile and desktop ones). The current situation is:

Desktop:

The goal:

  • The desktop site _should_ add an alternative link rel="alternate" media="only screen and (max-width: 640px)" with the mobile url as a target

Mobile current:

The goal:

  • Make sure, that this canonical link to the mobile page is always added, even if T93550 is fixed.

I hope I haven't missed anything :)

Currently not working on this, still waiting for blocked task, so "go out of my ToDo list (for now)" :P

Jdlrobson raised the priority of this task from Low to Medium.Sep 25 2018, 9:09 PM
Jdlrobson added a project: Web-Team-Backlog.
Jdlrobson updated the task description. (Show Details)
Jdlrobson added a subscriber: MaxSem.
SToyofuku-WMF subscribed.

It's been almost 10 years since this ticket had any real activity, and in addition I'm not clear what remains to be done. Closing for now, but feel free to reopen if you feel this was in error!