Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transclude a category in MediaWiki

Tags:

mediawiki

I'm not quite sure if this is possible in MediaWiki.

I've got several categories, each containing a few pages. If you open a category page you'll see the contents of the category that usualy consists of these three parts:

  1. A user defined text (which can be edited by using the edit link).
  2. All subcategories that are attached to this category.
  3. All pages that are attached to this category.

My goal is to create a page that includes at least part #3 of several categories. A page that shows me all page names that are attached to multiple categories of my choosing, grouped by their category.

My first approach was to use the standard transclude syntax of MediaWiki:

    Category A contains these pages:
    {{:Category:A}}
    Category B contains these pages:
    {{:Category:B}}
    Category C contains these pages:
    {{:Category:C}}
    ...

Unfortunatly, this only transcluded part #1 of a category: the user defined text. The page name listing was missing.

My second idea was to have a look at the parser functions. Perhaps there are some functions that offer enumerating through the pages of a category. But I didn't find any.

Perhaps there is a MediaWiki extension out there...

Is there a clever way to realize this?

like image 472
Typhix Avatar asked Jun 26 '09 19:06

Typhix


People also ask

How do you Transclude a page?

To transclude a subpage: The general syntax is {{Namespace:Pagename/Subpagename}} . On the parent page of a subpage, it is either the general syntax or {{/Subpagename}} . For a template namespace page, it is either the general syntax or {{Pagename/Subpagename}} .

What is Transclude in HTML?

January 2016. In computer science, transclusion is the inclusion of part or all of an electronic document into one or more other documents by reference via hypertext.

What is Noinclude?

Partial transclusion markup ‎</noinclude> means that the text between the tags is visible exclusively on the source page and cannot be transcluded onto another page.


2 Answers

Try http://www.mediawiki.org/wiki/Extension:CategoryTree, with the following syntax:

Category A contains these pages:
<categorytree hideroot="true" namespaces="-">Category A</categorytree>
like image 76
Joshua C. Lerner Avatar answered Oct 01 '22 04:10

Joshua C. Lerner


If you want more control over how the results are displayed, you may want to give Semantic Mediawiki a try.

The syntax would look something like:

Pages in Category A:

{{#ask:[[Category:A]]
|format=ul
}}

Even if you are not using semantic properties, you can use the query mechanism to display pages based on categories.

like image 35
Laurent Alquier Avatar answered Oct 01 '22 04:10

Laurent Alquier