Page MenuHomePhabricator

MobileFrontend configuration directive $mfNoIndexPages - wrong description and wrong name
Open, LowestPublic

Description

Description for configuration directive $mfNoIndexPages say:

#### $wgMFNoindexPages

Set to false to allow search engines to index your mobile pages. So far, Google
seems to mix mobile and non-mobile pages in its search results, creating
confusion.

* Type: `Boolean`
* Default: `true`

But this is completely wrong. If $wgMFNoindexPages set to true - only header

<link rel="alternate" media="only screen and (max-width: 720px)" href="https://m.example.com/wiki/Page_Name"/>

added to mobile pages and indexing mobile pages by search engines is not forbidden, see code in MobileFrontend/includes/MobileFrontend.hooks.php for details:

// an canonical/alternate link is only useful, if the mobile and desktop URL are different
// and $wgMFNoindexPages needs to be true
if ( $mfMobileUrlTemplate && $mfNoIndexPages ) {
        $link = false;

        if ( !$context->shouldDisplayMobileView() ) {
                // add alternate link to desktop sites - bug T91183
                $desktopUrl = $title->getFullUrl();
                $link = [
                        'rel' => 'alternate',
                        'media' => 'only screen and (max-width: ' . self::DEVICE_WIDTH_TABLET . ')',
                        'href' => $context->getMobileUrl( $desktopUrl ),
                ];
        } elseif ( !$title->isSpecial( 'MobileCite' ) ) {
                // Add canonical link to mobile pages (except for Special:MobileCite),
                // instead of noindex - bug T91183.
                $link = [
                        'rel' => 'canonical',
                        'href' => $title->getFullUrl(),
                ];
        }

        if ( $link !== false ) {
                $out->addLink( $link );
        }
}

Code for $wgMFNoindexPages directive and documentation for $wgMFNoindexPages is mismatch.

May be it is good idea to rename configuration directive $mfNoIndexPages and update it documentation?

Also see https://developers.google.com/search/mobile-sites/mobile-seo/separate-urls for details, adding

<link rel="alternate" media="only screen and (max-width: 720px)" href="https://m.example.com/wiki/Page_Name"/>

is not forbid search engines to index mobile pages.

Event Timeline

In https://developers.google.com/search/mobile-sites/mobile-seo/separate-urls :

If the desktop and mobile version of the page are treated as separate entities, both desktop and mobile URLs can be shown in desktop search results, and their ranking may be lower than if Google understood their relationship.

May be it is good idea to rename directive $wgMFNoindexPages to $wgMFEnableRelationship and update it description to something like this:

#### $wgMFEnableRelationship

Set to false if you want to break relationship between desktop and mobile version of articles. In this case the desktop and mobile version are treated as separate entities, both desktop and mobile URLs can be shown in desktop search results, and their ranking may be lower than if search engines understood their relationship.

* Type: `Boolean`
* Default: `true`

See T91183 for details - previously directive $wgMFNoindexPages completely blocks indexing of mobile version by search engines, but after T91183 it behavior was changed.

Jdlrobson triaged this task as Lowest priority.Apr 5 2022, 3:44 PM

This seems to only impact third parties. If there's no use case for this configuration we should probably remove it. Please let me know if that would be a problem.