Page MenuHomePhabricator

Not possible to configure Minerva main menu to use Special:RandomRoot instead of Special:Random
Open, NormalPublic3 Story Points

Description

Step of Reproduce

  1. Go to https://en.m.wikiversity.org
  2. Click On Menu and then Random.

Expected

should be shown only Root Random pages

Actual

There is some page comes, which is not Root Page.

Problem

The problem is that Wikiversity and like sister project have their main content in Root Pages. Subpage may be in bad condition. So Project like Wikiversity needs only show root pages.

Developer notes

Per @phuedx 's excellent suggestion instead of hardcoding this make use of the MediaWiki message Mediawiki:Random-url

We have a very similar handling when it comes to inserting community portal link (https://github.com/wikimedia/mediawiki-skins-MinervaNeue/blob/42dce8db1a96ce3f2c5d419b2e95dc03fb7b2284/includes/menu/Definitions.php#L301).

In order to make this work please

  • refactor insertCommunityPortal() into sth like buildMenuEntryFromMediaWikiMessage( $message ), and instead of hardcoded Portal-url use the $message variable
  • the insertCommunityPortal() method should call buildMenuEntryFromMediaWikiMessage( 'Portal-url' )
  • the insertRandomLink() method should call buildMenuEntryFromMediaWikiMessage( 'Random-url' )

Event Timeline

Restricted Application added a project: User-Jayprakash12345. · View Herald TranscriptMar 2 2018, 4:56 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Jdlrobson added a subscriber: Jdlrobson.

It looks like wgContentNamespaces is not configured for that wiki.
T125948 should provide some insight into how to fix that.
This is not an issue with MobileFrontend but how the site is configured.

Framawiki renamed this task from Mobile Web Version of English Wikiversity shows Random pages instead of RootRandom Page. to Set wgContentNamespaces for English Wikiversity.Mar 4 2018, 9:31 PM
Framawiki added a subscriber: Framawiki.

Hello @Jayprakash12345 ! Can you start a community discussion to decide which namespace to consider as "content namespaces" ? Thanks !

@Framawiki :

The mobile configuration should match the desktop configuration. The Random desktop link is already configured as:
Special:RandomRootpage

This uses the default namespace.

Thanks!

Hello @Jayprakash12345 ! Can you start a community discussion to decide which namespace to consider as "content namespaces" ? Thanks !

@Framawiki Dave Braunschweig Can. I am not community member of en.wikiversity. Thanks

Only namespace 0 (NS_MAIN?) is a content namespace.

We're not requesting additional functionality in this task, just consistency between mobile and desktop experiences.

Thanks!

TheDJ added a subscriber: TheDJ.

@Jdlrobson en.wikiversity uses a different Random link than the default in its sidemenu. Namely Special:RandomRootPage instead of Special:Random. As Minerva doesn't support MediaWiki:Sidebar, this isn't taken into account. See also: https://en.wikiversity.org/wiki/MediaWiki:Sidebar

TheDJ renamed this task from Set wgContentNamespaces for English Wikiversity to English Wikiversity uses a different Random link, which Minerva doesn't know about.Mar 5 2018, 6:54 AM

The wgContentNamespaces variable is used by a variety of content pages notably Nearby and Random. When I investigated this before for another wiki however I learned that it is a little overloaded with what it supports. I think the link updates in MediaWiki:sidebar were to route around problems with the code a long time ago but I'm not convinced they are still needed.

What are the downsides of setting wgContentNamespace to use the real content namespace? I see French wikiversity has. Won't that make the entire site better?
https://m.mediawiki.org/wiki/Manual:$wgContentNamespaces

I'm also confused by the comments above which says NS_MAIN #is# a content namespace thus it should show up in random if that's the case.

Consistency aside why is this setup this way?

@Jdlrobson

The best way to understand why might be the explanation at en.wikipedia: https://en.wikipedia.org/wiki/Help:Special_page .

"Special:RandomRootpage: redirects to a random root page, that is, excluding sub-pages. Some wikis, such as Wikibooks, use a sub-page hierarchy. This extension can be used there as a substitute for Special:Random, so it can be used to show "random books" in Wikibooks, instead of random pages"

Wikiversity has the same approach. We don't want to display lesson subpages. Subpages by themselves don't always make much sense. Just as you would start at the title page of a book, you should start at the root of a lesson.

So, rather than random pages, we only show randomrootpages.

The only namespace that has content is namespace 0, the NS_MAIN namespace.

Thanks!

Right. Got it. So this is about subpages not namespace.

Unfortunately that's not going to work in the mobile site right now or anytime soon as we don't have a good solution for T65459.

While, making the Minerva menu customisable would solve this problem on the short term, it doesn't help making the link behave correctly on new skins and other generic mediawiki-based clients e.g. Android and iOS apps who will assume Special:Random is the canonical link.

I'm a little confused why SpecialRandomRoot was defined as a separate page rather than a default.
Does it ever make sense to visit Special:Random on a wiki that has Special:RandomRoot ?
Would it make sense if wikis such as wikiversity could change the behaviour of Special:Random to behave like Special:RandomRoot ?

Jdlrobson renamed this task from English Wikiversity uses a different Random link, which Minerva doesn't know about to Not possible to configure Minerva main menu to use Special:RandomRoot instead of Special:Random.Mar 12 2018, 6:07 PM

@Jdlrobson

I think that's a valid assumption. I'm trying to think of a use case where a wiki would want RandomRoot for their main namespace but Random for one of the other namespaces. I'm not coming up with anything.

If I personally were rewriting Special:Random right now, I think it would be handy to have it support random page, random root page, and random subpage. For example, if I give it a prefix rather than just a namespace, it would find a random page in that namespace with that prefix. It's not something that would be used for the sidebar, but could be used for a variety of creative activities on projects that support subpages, such as a random chapter in a book or a random lesson in a learning project, etc. That, combined with redirect pages would make all kinds of interesting lessons possible.

Jdlrobson moved this task from Backlog to Bugs on the MinervaNeue board.Apr 26 2018, 11:38 PM
Jdlrobson moved this task from Bugs to New adventures on the MinervaNeue board.Feb 5 2019, 6:50 PM
phuedx added a subscriber: phuedx.Apr 24 2019, 4:50 PM

In the interest of fixing the discrepancy (at the expense of punting the more general problem, captured in T65459: Allow configuration of the Minerva menu), can we update MediaWiki\Minerva\Menu\Definitions::insertRandomItem to use

wfMessage( 'Mediawiki:Random-url' )->inContentLanguage()->plain()

instead of

SpecialPage::getTitleFor( 'Randompage' )->getLocalURL() . '#/random',

?

Jdlrobson updated the task description. (Show Details)
Jdlrobson triaged this task as Normal priority.
ovasileva moved this task from Needs Analysis to Upcoming on the Readers-Web-Backlog board.
ovasileva set the point value for this task to 3.May 22 2019, 4:56 PM
pmiazga updated the task description. (Show Details)May 22 2019, 5:53 PM