1

I want to be able to use the Categories of a page in a layout of another page.

Something like this:

[[Page1]] content: {{:page1}} 
[[Page1]] Categories: {{:page1|GETCATEGORIES}}

Here is page1:

Black

<noinclude>
[[Category:Color]]
[[Category:Dark]]
</noinclude>

I want the output to be: content: black Categories: Color Dark

2 Answers 2

2

You will need an extension for this. Here are some options:

  1. Semantic MediaWiki allows you to do queries like that.

  2. A simpler, but more limited way of doing the same thing would be to install the CategoryTree extension. Then you can write {{#categorytree:page1}} to show categories for page1

  3. Depending on your need, the best approach might be to write your own parser function extension, that adds a parser function to list the categories of a page.

0

If you don't want to use the semantic mediawiki, you can also use dynamic page lists and rely on its addcategories parameter. The DPL extension is quite powerful and is an alternative to semantic mediawiki (although the latter is a cleaner and better option if you have a choice).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.