Page MenuHomePhabricator

Allow exclusion of certain page images
Closed, ResolvedPublicBUG REPORT


To give editors a little more control. Adding the class notpageimage will exclude certain images from the algorithm which should be a useful addition to aid addressing many of the use cases brought up in T91683.



This new class can be used on all wikis as part of the train deploy beginning 14th Feb.


QA in production

Event Timeline

Change 736926 had a related patch set uploaded (by Jdlrobson; author: Simon04):

[mediawiki/extensions/PageImages@master] Allow editors control of the page image

Jdlrobson triaged this task as Medium priority.
Jdlrobson updated the task description. (Show Details)

Minor request: change the class name to notpageimage. nopageimage implies the page will not have a page image.

Also, consider whether the name should have a mwe- in front.

Lastly, this solution is non-trivial to implement programmatically on e.g. the Lua side. If I want to exclude images from all Navboxes and Sidebars (probably what this use case most wants to do), I need to hunt through the image syntax (an effort that even the current syntax highlighter fails at when embedded links are present, so this doesn't sound like fun), check for the class, and append the class if present and add the attribute with class if not.

Is there no way to implement this as finding a wrapper with the class and then discounting images inside it?

Jdlrobson claimed this task.
Jdlrobson added a subscriber: simon04.

Discussed in standup today and we are moving forward with this. It's a good first step! I did want to raise the concern that since we'll have the ability to remove the image before we have the ability to replace it with a more appropriate one, a number of articles that might have better images on the page might end up with no images at all.

Jdlrobson updated the task description. (Show Details)

Also, consider whether the name should have a mwe- in front.

No need for a prefix here. The class should not be used for anything outside it's purpose.

If and when T91683 is resolved then the class will likely become redundant and can just be removed.

change the class name to notpageimage

This change seems sensible and has been made. Thanks for the input.

Lastly, this solution is non-trivial to implement programmatically on e.g. the Lua side

Ack. It's an imperfect solution but should help in certain cases. I see the pages mentioned in is a trivial change to the template for example.

Change 736926 merged by jenkins-bot:

[mediawiki/extensions/PageImages@master] Allow editors control of the page image

  1. Re: Tech News - What wording would you suggest as the content? (drafts always help!)

IIUC, something like this... (I'm not certain about the details/extent of what this affects) in the "Recent changes" section ...

You can now prevent specific images that are used in a page from appearing in other locations, such as within PagePreviews or Search results. This is done with the markup class=notpageimage. For example, [[File:Example.png|class=notpageimage]].

  1. Re: docs - which pages should (or have been) updated with this new feature?

Once one of the documentation pages has been updated, we could also include a link to that, within the Tech News entry.

Edit conflict!! :D

I started the following topics of the only issue I am aware of:

@Jdlrobson Please confirm if the scope of affected pages is correct, in my draft wording above (i.e. just PagePreviews and Search results? or anything else?). Plus, thanks for the docs updates!

[EDIT: E.g. perhaps this also affects (some/all?) external websites that show link-previews automagically? ]

Just saw this in the Tech News. The question is: does this affect the Google Search?

Just saw this in the Tech News. The question is: does this affect thd Google Search?

From a brief discussion elsewhere, I believe the answer here is: We don't know exactly how Google determines which images to use, or when to use images (in their dozens of products/platforms). I.e. This new feature might have a partial (erratic/unpredictable) affect, or a reliable affect, or no affect (on any of their products).

I see. And what about the Linter rules update?

Hello, I would like to report some further issues/testcases. I added this class on [[Template:Journalism_sidebar]] and [[Template:Politics_of_Northern_Ireland]]. Both cases do not work yet (Examples: Investigative journalism and Courts of Northern Ireland). Izno suggested that this may be an issue with a cache and that I should wait longer, which may be the case. The journalism template was edited today (March 22), while the politics template was edited on March 8.

With template changes you may need to run action=purge on individual articles to verify and apps/api will update soon after. suggests this article has no page image so your change has worked. Same for Courts of Northern Ireland. Where are you seeing the image?

It does seem to be working now, thank you.