Page MenuHomePhabricator

Article tagline should be set by a hook, not by code highly coupled with Wikibase
Open, MediumPublic

Description

MobileFrontend can show nice article taglines (can be enabled by MFDisplayWikibaseDescriptions) . Sadly, this feature causes a hard dependency on WikiBase, and maitenance cost, as MobileFrontend has to know how to build Wikibase entities. It's not MobileFrontend reponsibility, thus should be removed from MobileFrontend codebase.

Acceptance Criteria

  • Article tagline is set up by the hook. MobileFrontendHooks::findTagLine should run a new hook.
  • Wikibase Client runs the hook to fill the Article tagline
  • ExtMobileFrontend::getWikibaseEntity() and ExtMobileFrontend::getWikibaseDescription() should be removed

Open questions

  • Should we rename the MFDisplayWikibaseDescriptions config?
  • Should we rename MobileContext:shouldShowWikibaseDescriptions() method?

Developer notes:

Proposed Hook name: MobileFrontendFetchArticleTagline

The best place to call the hook most probably is the SkinMinerva::getTaglineHtml() - we could abandon the wgMFDescription variable.
This would not only untagle MobileFrontend and Wikibase, but also remove one dependency between MobileFrontend and Minvera

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Jdlrobson subscribed.

Not a top priority but definitely something that needs to happen and likely requires involvement and guidance first from the Wikibase folk.

Would there be a possibility to provide a hook in core to override the site tagline so that the same feature can be used by other extensions and skins?
Currently there is no clean way to reproduce the said feature from MF without hardcoding it in the skin like Minerva does.

If it is generic then many third-party wikis and developers can be benefited from such feature, and this task will be less affected by the on-going movement to decouple short description from Wikibase (T282170).

@alistair3149 I think that would be a great idea. Are you wanting to consume this in a skin that uses SkinMustache or BaseTemplate?

I guess T282170 would need to happen first, as we'd need to get Wikibase and MobileFrontend's handling out of the picture first. Then hopefully it's as simple as adding a value to both template's data.

@alistair3149 I think that would be a great idea. Are you wanting to consume this in a skin that uses SkinMustache or BaseTemplate?

I guess T282170 would need to happen first, as we'd need to get Wikibase and MobileFrontend's handling out of the picture first. Then hopefully it's as simple as adding a value to both template's data.

Yes I am looking to incorporate the feature once core has support for it. Sadly I have to develop with LTS due to our production wiki so I have to wait till the next LTS.

As for T282170, I don't view it as a blocker but the other way. Wikibase, MF, and Minerva will have to migrate to a new solution, and it would be moving everyone forward if core provides that connection.

From my observation with Minerva (MF), Short Description gadget, and the Android app, there's a pattern to put article tagline under the first heading, replacing the site tagline. The easy and more compatible solution might be to add a hook that allows extension and skin to modify the site tagline message on individual pages. The other solution is to have a separate message so that the site tagline is preserved but it would require skin developers to add support for it manually, so there would be a transition phase assuming the skin is maintained.

As a third party wiki admin and a skin developer, I'm not familiar with the ecosystem with Wikibase and WMF so please correct me if I'm mistaken.

Yeah I think this should be a core hook, not a skin hook. There are several uses for a short article description (I'd avoid "tagline" which is more about where it is displayed than what it contains), e.g. currently VisualEditor is using it for link suggestions, or the mobile apps use it via an API.

Whether it makes sense to also have a hook in MobileFrontend to determine what the tagline should be (which would then invoke the core hook), or just hardcode it to always show the short description, I'm not sure. Can you envision a wiki where the tagline is not a short description of the article but something different?

Yeah I think this should be a core hook, not a skin hook.

Yes it should be a core hook that is accessible by both skins and extensions.

Can you envision a wiki where the tagline is not a short description of the article but something different?

By default the tagline is the content of MediaWiki:Tagline. Short description is exclusively used by wikis that is accompanied by Wikibase, which is mostly WMF wikis so most wikis either have it hidden or use a site tagline. There are also other usage for the tagline such as Minerva put registration date on the user pages.

Whether it makes sense to also have a hook in MobileFrontend to determine what the tagline should be (which would then invoke the core hook), or just hardcode it to always show the short description, I'm not sure.

Last I checked MobileFrontend looks for the short description from Wikibase and set a global variable, and Minerva check if it exists, so the display is hardcoded into Minerva.

I'd avoid "tagline" which is more about where it is displayed than what it contains

I use the term "tagline" as this task as it is just how it was referred in the task. Nevertheless I view this task as creating a core hook to set the generic tagline of a page rather than strictly short description, as there are other usages outside of article namespace and it can be useful for extensions and special pages.

To be more specific, there should be:

  1. Core hook that allows extensions to define the description property of the page, as it is how VE and the app retrieve the short description from a page
  2. Description should feed into SearchResultProvideDescriptionHook, which is used by the MediaWIki Search REST API
  3. A way for skin developer to display the description

The above all makes sense to me @alistair3149 .

Would this replace the site tag line or would this be additional to that?

Screen Shot 2021-06-03 at 5.39.50 PM.png (164×858 px, 28 KB)

The above all makes sense to me @alistair3149 .

Would this replace the site tag line or would this be additional to that?

Screen Shot 2021-06-03 at 5.39.50 PM.png (164×858 px, 28 KB)

I can only speak from a skin author perspective since short description is mostly used in English Wikipedia currently and I'm not familiar with it.

Being able to access both site tagline and description in SkinTemplate and SkinMustache would allow skins to decide how and whether to display them. For example Vector might want to have both in DOM and display them in the same position, but hide site tagline with CSS (though I'm not sure on the accessibility implications on that). Minerva might want to only include one in DOM, and some other skins might want to display both but in different locations.

Looked into this a bit more.
It looks like the magic word {{SHORTDESC}} is provided by Wikibase so there is no core definition of "article description".
https://gerrit.wikimedia.org/g/mediawiki/extensions/Wikibase/+/7c508d5b1b75bf6d895f2ff84c472dda01f63e50/client/includes/Hooks/ShortDescHandler.php#94

This sets a page property wikibase-shortdesc (https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/Wikibase/+/7c508d5b1b75bf6d895f2ff84c472dda01f63e50/client/includes/Store/DescriptionLookup.php#37)

To do this we'll either need to:

  • Create a component that defaults to an empty string and requires a hook to update. Wikibase would call this hook to update the description
  • Create a generic subtitle component that gathers these related concepts (e.g. existing subtitle but at cost of less flexibility so skins)
  • Allow extensions to add components to skins (needs more architectural changes)
Jdlrobson raised the priority of this task from Low to Medium.Apr 28 2022, 10:11 PM