I have subpages enabled for some namespaces because we have some documentation sections that benefit from a hierarchical structure. I'd like to change how subpages are displayed in the category listings on category pages so only the subpage base page is used instead of the full page title, and would appreciate any advice.
For example, assume I have pages called "Foo" and "Foo/Bar" in category "XYZ". With the default configuration, the pages will show up as "Foo" and "Foo/Bar under "F" on the category page. This confuses users because they're actually looking for "Bar" under B.
I know I can use: [[Category:XYZ|{{SUBPAGENAME}}]] so that the page will be indexed by the subpage name, but all that will do is make "Foo/Bar" appear under "B" under on the XYZ category page (it still displays the full page name).
What I would like is to have "Foo" appear under "F" on the XYZ category page, and "Bar" under "B". Ideally this would occur site-wide to all subpages, without having to add any special markup to the category definition on the individual pages or the category pages. It's not out the question for us to write an extension. That would be preferable to a source code hack, but I'm open to any suggestions!
It would also be helpful if anyone had ideas on how to make [[Category:XYZ|{{SUBPAGENAME}}]] the default for pages, without inserting it on every page or doing a page preload.