Page MenuHomePhabricator

"MediaWiki:Mainpage": Linking the logo to an anchor link does not work, anchor link works as expected in side bar
Closed, ResolvedPublic

Description

If you change the main page on MediaWiki:Mainpage to a link with a hash (ie: Other Page#Section), the "Main page" link in the sidebar is correctly implemented (the link goes to Other Page#Section), but the logo drops the unexpectedly drops the hash (the link goes to just Other Page).

Event Timeline

I do not consider this a bug as the name of an anchor on a page is not the same as the name of a page?

If you change Mediawiki:Mainpage to something, would you not expect the two places that use that value (the "Main page" text link and the logo) to both use that value consistently? The text link goes to the exact destination that I specified where as the image link only goes part of the way.

No, as for sidebar items it feels more usual to link to some anchors. I would not expect that from a top-level logo link... :)

Aklapper triaged this task as Lowest priority.Sep 24 2017, 11:26 PM

For anyone else who might run into this issue and get annoyed at this bug, I mean "undocumented feature", and want to make your link to go to where you set it, here's a "temporary" hack to fix this:

$wgHooks['SkinTemplateOutputPageBeforeExec'][] = 'lfChangeMainPageURL';
function lfChangeMainPageURL( $sk, &$tpl ) {
	$tpl->data['nav_urls']['mainpage']['href'] = '/where/you/want/your/link/to#go';
	return true;}
Aklapper renamed this task from MediaWiki:Mainpage Hash Links to "MediaWiki:Mainpage": Linking the logo to an anchor link does not work, anchor link works as expected in side bar.Sep 25 2017, 10:47 AM

Change 381134 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/core@master] Consistently preserve anchors in the title specified in 'mainpage' message

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

Change 381134 merged by jenkins-bot:
[mediawiki/core@master] Consistently preserve anchors in the title specified in 'mainpage' message

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

matmarex claimed this task.
matmarex removed a project: Patch-For-Review.