Page MenuHomePhabricator

Enable PageImages on Commons categories namespace
Open, Needs TriagePublic

Description

At, e.g., https://commons.wikimedia.org/w/index.php?title=Category:San_Francisco&action=info there is currently no page image, despite the commons category having an infobox with a main image. That means that when a link to the commons category is shared on twitter/facebook etc., no image is shown as there is no og:image meta tag.

It looks like this might be as straightforward as changing $wgPageImagesNamespaces to include categories.

Event Timeline

Mike_Peel created this task.Jul 3 2018, 2:45 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 3 2018, 2:45 PM
Deskana added a subscriber: Ramsey-WMF.

Perhaps @Ramsey-WMF might want to take a look at this.

Jdlrobson added a subscriber: Jdlrobson.

Lemme know if the config change doesn't resolve this. If it doesn't I can arrange some further investigation from our side.

I've mentioned this at https://commons.wikimedia.org/wiki/Commons:Village_pump#Enable_PageImages_on_Commons_categories to make sure that this is OK with the wider commons community.

Isnt it adding a Twitter Cards what should be done?

<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@WikiCommons" />
<meta name="twitter:title" content="Category: San Francisco" />
<meta name="twitter:description" content="Media about the Consolidated city-county in California, United States" />
<meta name="twitter:image" content="https://commons.wikimedia.org/wiki/Category:San_Francisco#/media/File:San_Francisco_(Evening).jpg" />

Maybe the Template Infobox Wikidata could create those meta tags?

Isnt it adding a Twitter Cards what should be done?

I think PageImages does this in a more generic way that works with all services, through OpenGraph ('og:image'), but I could be wrong.

The meta tags need to be in the page header, and the infobox can only add content to the page body, so the infobox can't add the tags.

Change 446257 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[operations/mediawiki-config@master] PageImages: Make it possible to add extra namespaces

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

Change 446257 merged by jenkins-bot:
[operations/mediawiki-config@master] PageImages: Make it possible to add extra namespaces

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

Mentioned in SAL (#wikimedia-operations) [2018-08-06T23:38:11Z] <jforrester@deploy1001> sync-file aborted: SWAT PageImages: Add NS_CATEGORY for Commons T198716 (duration: 00m 04s)

Needs more work, sorry.

Change 450885 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[operations/mediawiki-config@master] Re-apply "PageImages: Add NS_CATEGORY for Commons"

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

I'm assuming this is the culprit for this error I'm seeing in logstash?
Warning: Invalid operand type was used: array_flip expects an array or collection in /srv/mediawiki/php-1.32.0-wmf.15/extensions/PageImages/includes/ParserFileProcessingHookHandlers.php on line 123

Jdlrobson moved this task from Inbox to Tracking on the User-Jdlrobson board.Mar 2 2020, 10:48 PM

I assume this didn't get fixed? Can https://gerrit.wikimedia.org/r/#/c/operations/mediawiki-config/+/450885/ be easily rebased?

Change 579067 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[operations/mediawiki-config@master] Enable PageImages on Commons categories

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

^ is there any reason why this would not work?

Change 579067 abandoned by Jdlrobson:
Enable PageImages on Commons categories

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

Jdlrobson renamed this task from Enable PageImages on Commons categories to Enable PageImages on Commons categories namespace.Thu, Jun 18, 4:58 PM
Jdlrobson removed a project: PageImages.
Jdlrobson added a subscriber: ovasileva.

@Mike_Peel is this still needed? If so @Ramsey-WMF is this something your team or our team (@ovasileva ) could look into?

@Mike_Peel is this still needed? If so @Ramsey-WMF is this something your team or our team (@ovasileva ) could look into?

Yes. I've just tested it on Facebook - if you share https://en.wikipedia.org/wiki/San_Francisco then you see an image but if you share https://commons.wikimedia.org/wiki/Category:San_Francisco then you don't. I also tried on Twitter, but I couldn't actually get either link to show an image there...