I'm trying to make a Character template that can auto-fill categories, but I also want those categories has icons next to their text in the infobox (and only in the infobox!).

    As you can see, I managed to get the icons appear in the infobox, but it makes the auto-categories broken.

    Is there a way to make both functions work?

      Loading editor
    • Okay so there are two ways categories can be put on a page via wikitext and they do different things...

      1. [[Category:CATEGORYNAME|SORTKEY]]
        where this appears the page it is on will be added to the category called CATEGORYNAME; the entry in the category list will sort based on the SORTKEY (using just a space character: like [[Category:CATEGORYNAME| ]], will sort it above everything else rather than putting it under a number or letter); nothing will be seen on the page itself where this wikitext is included
      2. [[:Category:CATEGORYNAME|LINK_TEXT]]
        this just creates a link to the category page at Category:CATEGORYNAME

      So, if you want to include a page where the template is used in a category, use the first type and if you just want a link, use the second type. If you want to do both, you need to use both types, i.e. [[:Category:{{{gender}}}|{{{gender}}}]][[Category:{{{gender}}}|{{{gender}}}]] and only a link {{{gender}}} (whatever is in the variable) will actually be visible.

        Loading editor
    • Regarding the first format, you don't have to provide a sort key. If you don't provide a sortkey, the page will be sorted by its name (ignoring the namespace). Some wikis like to use [[Category:CATEGORYNAME|PAGENAME]] but unless you include the namespace, it is effectively the same as [[Category:CATEGORYNAME]].

        Loading editor
    • I think you meant [[Category:CATEGORYNAME|{{PAGENAME}}]], so you can rename the page and the sort key will change too.

        Loading editor
    • That is what I was going for but I thought it might be too confusing to use caps in two different contexts.

        Loading editor
    • Thanks, I managed to make it work!

        Loading editor
    • A FANDOM user
        Loading editor
Give Kudos to this message
You've given this message Kudos!
See who gave Kudos to this message
Community content is available under CC-BY-SA unless otherwise noted.