Page MenuHomePhabricator

Add 'link' param to {{PAGEBANNER}} to change target
Closed, ResolvedPublic


It'd be useful to be able to change the target of a banner's link. A link=Page name parameter would be in line with standard image syntax. An empty value link= should remove the link entirely.

Event Timeline

Could you eloborate a bit on the usecase here? Thanks!

A couple of ideas:

  • to prevent users clicking on something that is just decoration.
  • to link to the more suitable page for a given image (e.g. an image might have multiple versions, one of which is the banner-cropped one, and they all be listed on a single page and it's that page that we'd want people to end up on).
  • a banner might be used as an event announcement, and clicking on it could go to an external ticketing page.

Two further points:

  • Images are commonly used like buttons on websites these days. Media Wiki doesn't currently seem to have that capacity. This would enable images to be used in that way.
  • When you click on an image at the moment it takes you to the image on Wikimedia Commons on Media Wiki sites, which is not how regular images behave on standard static websites. This is confusing for our audiences and could mean then get lost and don't know why or how they've got to the image source page. For example on the Wikimedia Australia home page, we would prefer the #1Lib1Ref banner to take the reader to the 1Lib1Ref page. Currently they have to click on the exact heading link or they will not see the content we want them to see.

This function in particular is really going to help Media Wiki function as a general website. It will be really great!

Good points @Tenniscourtisland

On the matter of images in general though, note that the [[File:Example.jpg|link=Foo]] syntax already exists and solves this problem for those images (I've just made the change the to WMAU homepage! thanks for pointing it out, I should've noticed before), so the missing bit is to add the same functionality to the banner image at the top of the page.

Ah my apologies. I see.

This will still be very very useful for the banners also, as similar issues remain for those also. We ideally want the option of them being unlinked/static to avoid navigational confusion.


@Samwilson got it. I guess the challenge here is making sure the image is still attributed. We'd probably want to talk to the Wikivoyage community first with around revisiting that. Perhaps some text can be added in the footer to handle the attribution to add link support.

I'm not sure I understand the concern about attribution: surely the same problem applies to any image in a wiki that's not got a link? And MediaWiki has had those forever.

If Wikivoyage wants to always link to the banner image, they'd just have to not add |link= — and given they call {{PAGEBANNER}} in a protected template, it seems unlikely that it'd be added by accident.

I guess you're right. I'm not sure why this was made into a link if attribution was not the reason. With respect to "to prevent users clicking on something that is just decoration." I am wondering if this should be default behaviour but I'd want to check in with English Wikivoyage before dropping that behaviour. It does seem a bit odd that clicking a banner would take you to the file page... to be honest it feels odd that there's a link in the first place.

Given images accept a link property it makes sense that this would to, particularly given it is rendering an image but I'd want to get some more input from others on whether that makes sense if we're going to pursue this.

I'm happy to work on this, if you agree that a new link param is the right way to go (I don't want to start if it's not likely to be accepted). The link param would also give Wikivoyage the option of not linking, they'd just need to update their template. Seems pretty low-risk to me.

I'm happy to defer to your best judgement here Sam :) I can review providing it has tests.

Change 712916 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/WikidataPageBanner@master] Add link parameter to customize link target

Samwilson changed the task status from Open to Stalled.Aug 23 2021, 2:49 AM

This is stalled awaiting T288884.

Samwilson changed the task status from Stalled to Open.Sep 20 2021, 7:15 AM

No longer stalled.

Patch is ready for review.

Change 712916 merged by jenkins-bot:

[mediawiki/extensions/WikidataPageBanner@master] Add link parameter to customize link target

Change 722709 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/WikidataPageBanner@REL1_36] Add link parameter to customize link target

Thanks @Jdlrobson! I've updated the docs, and backported to 1.36, and will now update the WMAU website.

Change 722709 merged by jenkins-bot:

[mediawiki/extensions/WikidataPageBanner@REL1_36] Add link parameter to customize link target