Page MenuHomePhabricator

Review onHtmlPageLinkRendererEnd hook handler
Closed, ResolvedPublicBUG REPORT

Description

Description

The link modification code in the PageRenderingHandler::onHtmlPageLinkRendererEnd handler is specifically crafted for zobject pages. It is very likely that this does not adapt well to abstract content.

We should review, understand and adapt to the current multi-mode/multi-content needs.

Impact on users

Users exploring or monitoring Abstract Wikipedia cannot easily understand which topics articles represent when only QIDs are shown. This makes it harder to discover existing content, view examples, and quickly interpret activity across special pages.

Compare:
https://abstract.wikipedia.org/wiki/Special:AllPages vs https://www.wikifunctions.org/wiki/Special:AllPages
or
https://www.wikifunctions.org/wiki/Special:RecentChanges vs
https://abstract.wikipedia.org/wiki/Special:RecentChanges

Completion checklist

Event Timeline

Jdforrester-WMF changed the task status from Open to In Progress.Mar 18 2026, 5:08 PM
Jdforrester-WMF triaged this task as Medium priority.

To do this, we'll need (in abstract mode when the target is an AW page) to (if the WikibaseClient extension is available), get an EntityLookup via the ClientStore and use it to get the label of the item in our language.

Very rough code from semi-memory and semi-looking-at-what-we-did-in-WikifunctionsPFragmentHandler:

if ( !ExtensionRegistry::getInstance()->isLoaded( 'WikibaseClient' ) ) {
	return false;
}


// Note: This line should be done once in the constructor
$wbEntityParser = \Wikibase\Client\WikibaseClient::getEntityIdParser();

try {
	$itemId = $wbEntityParser->parse( $qid );
} catch ( \Wikibase\DataModel\Entity\EntityIdParsingException ) {
	// Not a valid Wikidata reference
	return false;
}

// Note: This line should be done once in the constructor
$wbEntityLookup = \Wikibase\Client\WikibaseClient::getStore()->getEntityLookup();

$wbEntity = $wbEntityLookup->getEntity( $itemId );
$labels = $wbEntity->getLabels();

Hope this helps.

TY @Jdforrester-WMF do you think it makes sense to implement this logic into onHtmlPageLinkRendererEnd()

TY @Jdforrester-WMF do you think it makes sense to implement this logic into onHtmlPageLinkRendererEnd()

Oops, sorry, yes!

Change #1268668 had a related patch set uploaded (by Ecarg; author: Ecarg):

[mediawiki/extensions/WikiLambda@master] enable abstract mode for html links

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

Change #1268668 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] PageRenderingHandler: Show a labelled links to Abstract Articles on special pages, like for ZObjects

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