Extension talk:CategoryTree

About this board

How to set depth to 1 on category pages?

Stefahn (talkcontribs)

If I use the <categorytree> tag, the first level of the tree is shown, that means the given category is expanded. That corresponds to depth = 1 (default).

But on category pages the subcategories are not expanded, that means depth is somehow set to 0. How can I set the depth to 1 for category pages?

Thanks for any help!

Tacsipacsi (talkcontribs)
Stefahn (talkcontribs)

Thanks for the hint. Is there a docu how to set $wgCategoryTreeCategoryPageOptions, do I just assign a number to it or are there different modes?

Reply to "How to set depth to 1 on category pages?"

Wrong style of Category Tree in Sidebar

NicolasEcarnot (talkcontribs)


I've just upgraded from 1.35 to 1.39.5 (Debian 10 to 12), and upgraded Vector skin to 1.0.0 and Category Tree to the relevant version with 1.39.5 (appearing as 4d3a290 in Versions page).

The Category Tree is appearing correctly in the sidebar, but the fonts are way bigger than they were before the upgrade. I have no clue where to manage the css style of the category tree when it's embedded in the sidebar, or whether it's possible in the first place?

Thank you for any advice.


Coltzer (talkcontribs)

Hey @NicolasEcarnot, hopefully this helps.

There is array variable you can set in LocalSettings.php called $wgCategoryTreeSidebarOptions.

It took me a while to figure out how exactly to format it and what options could be used since I'm still relatively new to MediaWiki administration, but this is what I used on my private MW instance (your probably mainly concerned with the 'style' setting):

$wgCategoryTreeSidebarOptions['depth'] = 2;
$wgCategoryTreeSidebarOptions['mode'] = 'categories';
$wgCategoryTreeSidebarOptions['style'] = 'font-size:0.75em';

I'm pretty sure I came up with 0.75em by inspecting the content of the stock sidebar to see what font size it was using.

Reply to "Wrong style of Category Tree in Sidebar"
Xaosflux (talkcontribs)
Reply to "mode is broken"

In combination with Translate

Ordovicium (talkcontribs)

What is the best use case to use this extension in combination with the extension Translate? Can I only list the subpage with the language code /de e.g. or can I use for each link Special:MyLanguage

Reply to "In combination with Translate"

sidebar root does not show up with timeless skin

T tfbb (talkcontribs)

hi -

thank you very much for your work. After upgrading mediawiki from v1.35 to 1.39, the sidebar root won't show up when using the timeless skin bundled with mediawiki - this worked fine with v1.35. It also works fine with the vector (2022) skin, the configuration is rather minimal:

$wgCategoryTreeSidebarRoot = "categories";
$wgCategoryTreeForceHeaders = true;
$wgCategoryTreeSidebarOptions["depth"] = "2";

with kind regards, thoralf.

Reply to "sidebar root does not show up with timeless skin"

category pages not displayed in sidebar

Xavi.developer (talkcontribs)

I am able to display both categories and pages inside a page with code

<categorytree mode="pages">ParentCategory</categorytree>

but when adding this to LocalSettings it just displays categories

wfLoadExtension( 'CategoryTree' );

$wgCategoryTreeSidebarRoot = "ParentCategory";

$wgCategoryTreeDefaultOptions['mode'] = 'pages';

I have also tried

$wgCategoryTreeDefaultMode = 10;

what am I missing?

imgur .com/a/kMWYpmJ


Tacsipacsi (talkcontribs)

The configuration option $wgCategoryTreeSidebarOptions, which overrides the defaults set in $wgCategoryTreeDefaultOptions. I think you should be able to remove the override by calling unset($wgCategoryTreeSidebarOptions['mode']); but if you actually don’t want to override the default mode for category trees added in wikitext, you can just set $wgCategoryTreeSidebarOptions['mode'] = 'pages'; and remove the $wgCategoryTreeDefaultOptions['mode'] setting.

Reply to "category pages not displayed in sidebar"

Insert magic words in CategoryTree

2 (talkcontribs)

Is possibile insert magic words in tag categorytree? <categorytree hideroot="true" namespaces="-">Fondata_a_{{subst:#time:F}}</categorytree>. Because no works

Tacsipacsi (talkcontribs)

You can use {{#tag:categorytree}}. If all magic words used in the category name are subst’ed, {{#tag:}} can also be safely subst’ed, which turns it back into the tag format, but only after processing its content. (If there are any not subst’ed parser functions in the content, subst’ing {{#tag:}} would bring us back to the original issue.)

Reply to "Insert magic words in CategoryTree"

Group pages by categories

Dimka665 (talkcontribs)

I have pages with categories:

  1. A and B
  2. A and B
  3. A and C

How to group pages with A category by other categories? Any ideas?

<categorytree mode="pages">A</categorytree>


Ciencia Al Poder (talkcontribs)

I don't know if an extension like this exists, but CategoryTree isn't one of them

Reply to "Group pages by categories"

showing tree with a position within it highlighted

Vicarage (talkcontribs)

I was hoping that categorytree would show a tree from a particular point with my current page highlighted and expanded within it. so for page "ringwork castles"

  > Forts
     '''ringwork castles'''
     motte and bailey castles
  > Bunkers  

so I could explore the whole tree, but have the branch to my page expanded. Having a complete tree with my place unobvious, or having a parental tree without siblings, is a lot less useful to me

Reply to "showing tree with a position within it highlighted" (talkcontribs)

I'd like to make a category tree for a sub-category, but only if the elements are also in another category. Is this possible? Thanks in advance.

Tacsipacsi (talkcontribs)

No, there is currently no option for this. (talkcontribs)


I have the same needs, mentioned 4 years ago. Does the mediawiki propose now some solution for such feature ?

Thank you for your answer.

Best regards (talkcontribs)

Also have the same needs - I guess there is no solution and we basically have to make combinatorial categories as a clunky workaround?

Reply to "Conditional Trees?"