Topic on Manual talk:How to make a MediaWiki skin

Summary by Jdlrobson

At time of writing there is no way to customize the categories HTML list but this would be a good addition. This is tracked in phab:T298302. Patch welcome.

Nasirkhan (talkcontribs)

How to show and format category links. I found {{{html-categories}}} in the skin but could not found much about it. It is always returns as formatted html or can i get category links and names as array?

Nasirkhan (talkcontribs)

It would be really helpful if you can show me some reference/ related data, hooks or something similar to implement that. I will try from my end about the customization and then submit a patch.

Jdlrobson (talkcontribs)

The HTML string from categories is passed to the Mustache template using Skin::getCategories

https://gerrit.wikimedia.org/g/mediawiki/core/+/87500874e2b55e3da0735d71b0a0123882e149b5/includes/skins/SkinMustache.php#187

We could add an additional key `data-categories` that provides the data without the surplus HTML markup by refactoring Skin::getCategoryLinks to call a function called Skin::getCategoryLinksData https://gerrit.wikimedia.org/g/mediawiki/core/+/87500874e2b55e3da0735d71b0a0123882e149b5/includes/skins/Skin.php#682 and then calling the new getCategoryLinksData inside the SkinMustache::getTemplateData function. Does that make sense?