Extension talk:CategoryTree

About this board

Avoiding duplicates in the tree

1
WilkeKevin (talkcontribs)

On my wiki, I used to include all parent categories in the list of categories at the bottom of each page. For example, for a page named "Dachshund", in addition to the "Dog" category, I would also put the "Mammal" and "Animal" categories. Same for category pages, so on the "Dog" category page, I would assign it the "Mammal" and "Animal" categories, etc. I did it this way because I felt that when someone lists all members of the "Animal" category, they should see the subcategories and their pages as well. But that means you end up with a category tree like this:

 Animal
 + Dog
   + Dachshund
 + Mammal
   + Dog
     + Dachshund
   + Dachshund
 + Dachshund

This bothered me, so I made a patched version of the CategoryTree code that produces a tree like this:

 Animal
 + Mammal
   + Dog
     + Dachshund


But then I decided it wasn't worth the effort updating the patch for new MW releases, so I switched back to regular CategoryTree and I don't include parents, grandparents, etc. in categories and pages on my wiki anymore. Anyway, I just wanted to share my thoughts and experience.

Reply to "Avoiding duplicates in the tree"

How to set depth to 1 on category pages?

3
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

2
NicolasEcarnot (talkcontribs)

Hello,

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.

Nicolas

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

1
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

1
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

2
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


Thanks

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
79.46.196.38 (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

2
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>

Display:

A
   B
       1
       2
   C
       3
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

1
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"

Fortification
  > Forts
  Castles
     '''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"
Return to "CategoryTree" page.