Page MenuHomePhabricator

Scribunto/Lua should have a built-in method for retrieving category members
Open, Needs TriagePublicFeature

Description

Per WikiProject Portals discussion on enwiki:

Some portals would like to show an excerpt from a page chosen from a category. Is there any way for a module or template to list the members of a category? title:getContent() on a category page just returns the "This is a list of foos" blurb, not the actual members. mw.site.stats.pagesInCategory counts the pages but doesn't reveal the titles. getContent doesn't work on Special:RandomInCategory, and transcluding it just produces a link rather than the text. Surely we don't need to write a bot to periodically copy the category page to a standard page (which we can then read easily)? Certes (talk) 01:32, 28 April 2018 (UTC)

Attempting to expand or pre-process a category tree or a Special:WhatWhatLinksHere page does not work either.

From the final comment in that thread:

This is another use-case for an interface between the MediaWiki API and Lua, even if only some API entry points.

Event Timeline

There's another potential application of this being discussed at https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)#For_loops_for_a_category. I hope this eventually makes it out of the backlog.

Another possible application of this, a template that'd allow pinging of all members of a category, has come up here.

Tacsipacsi changed the subtype of this task from "Task" to "Feature Request".Apr 17 2022, 4:31 PM
Tacsipacsi subscribed.

This is not the same as T50175, so unclosing.

This task is allowing Lua, given a category name, to find all pages that are in this category. That task is to get all categories on a given page.