Requests for comment/Accessing page properties from wiki pages

This is a request for comments regarding accessing page properties from wiki pages.

Background
MediaWiki has a page_props database table where certain attributes and values are stored on a per-page basis. For example:

MediaWiki stores whether a page is a disambiguation page, what its default category sort key is, and what its page image is, each being determined by different means:,  , and a heuristic (cf. Extension:PageImages).

Problem
Users cannot access a page's properties from other local wiki pages.

Potential use-cases:


 * T71441: Feature request: add detection for disambiguation pages to Scribunto
 * T131911: Allow retrieving/getting page image file name from wikitext using Scribunto/Lua or parser function or something
 * T154346: Provide "wikitext" means of accessing arbitrary wiki page's default category sort key

Complications
This makes wikitext more volatile. We already have features such as  and , which can be combined in weird and potentially abusive ways. For example:.

If we added the ability to get page properties, we could end up with cases such as these:



While we could try to restrict page property retrieval to pages other than the current page, you could end up with trivial loops: page A tries to get page B's category sort key, page B tries to get category A's category sort key. These types of problems have been solved by templates.

It's also currently possible to do things like this: w:en:User:Sgeo/null-edit-detector.

You also have a problem that's basically the opposite of volatility: if a page's default category sort key changes, how do know to update the pages, such as its talk page, that are also using this sort key?

Option 1
Modify Scribunto/Lua to expose these properties as functions or Title object attributes.

Option 2
Add parser functions to MediaWiki core or to extensions such as PageImages. For example:



Option 3
For two of the use-cases, the focus is talk pages. So we could add:



But this is kind of obnoxious and it boxes us in a bit. We may want to break out of the subject space page–talk page binary at some point, supporting groupings of three or four or more pages. On a related point, we may want to use this functionality on non-talk pages, which is the case for properties such as page images.

Option 4
Do nothing. Don't allow access to these page properties. :-(

Option 5
Here's a dumb idea: use the existing templates/transclusion system, either by creating a template for every page and property or by using Extension:LabeledSectionTransclusion to extract parts of a subject-space page.

This would be pretty terrible, but would save making a new links table and would require almost no development effort.