Help:Category Markup
From Jackcentric
This page contains technical guidance for using wiki markup with categories. If you're not familiar with wiki categories, please read Help:About Categories first. You may also want to read Help:Wiki Markup.
[edit] Adding Categories to a Page
To add a page to a category, simply edit the page and add the code [[Category:CategoryName]]. For instance, a Jack/Estelle story would go in [[Category:Jack/Estelle]], your user page goes in [[Category:Users]], and a new help page would go in [[Category:Help]].
Please put the category code at the bottom of the edit field. Categories will appear in the box at the bottom of the page regardless of where you place the category code in the text. However, keeping all the categories together at the bottom will make editing the page easier for everyone and is a standard practice across many wikis.
A page can be in many different categories at once, as many as are useful and accurate. Each separate category needs its own code: [[Category:Category1]] [[Category:Category2]], for instance, not [[Category:Category1, Category2]]. It's common to place multiple categories on the same line with one space between them, but you may find easier to work with if you place each category on its own line. Either will work. Try to arrange multiple categories in general order of significance: more important categories come before less important ones, and broader, more general categories come before narrower, more specific ones.
Things to watch out for:
- There should be two brackets on each side of the category code, not one, not three. Keep an eye on this especially when you're copying and pasting text; it can be easy to lose a bracket.
- There should be no space after the first colon. If the category name itself has colons in it (such as Era: 1960s or Episode: TW: Adrift), do include one space after those colons, but only those colons.
- If the category name appears as a red link when you preview the page, it means the category as you have typed it does not currently exist. Please doublecheck that you've typed everything correctly, included the right spaces and colons, and otherwise named the category correctly. You can browse our category tree or review the alphabetical list of categories to see what category names already exist; please do not create a new category unless you've first checked to be sure that a similar category doesn't already exist.
[edit] Referring to Categories in Text
To add a link to a category that's just a navigational link and doesn't add the page you're editing to that category (this page, for instance, doesn't belong in Category:Jack/Estelle), add a colon before "Category", like this: [[:Category:Jack/Estelle]].
To add a category link that's named something else (such as Jack/Estelle or this category over here), use the colon in front and a pipe (|, located above the backslash key) to separate the actual link from the linked text, like this: [[:Category:Jack/Estelle | Jack/Estelle]] or [[:Category:Jack/TARDIS | this category over here]]. Spaces on either side of the pipe are not necessary but can make the code easier to read.
If you want to correctly show the category code without a link or adding the page to the category (such as when editing help pages), you'll need to surround the code with <nowiki> tags, like this: <nowiki>[[Category:Jack/Nine]]</nowiki>. This tells the wiki to treat what you're typing as just plain text, despite the brackets that would normally make it into wiki markup.
You type: | Appears as: |
---|---|
[[Category:Drabbles]] | Will add the page to the Drabbles category, and the "Drabbles" text will show up only in the category list at the bottom of the page. |
[[Drabbles]] | Drabbles -- Will link to a new drabbles page in the main namespace, which shouldn't exist. Don't do this! |
[[:Category:Drabbles]] | Category:Drabbles -- Creates a followable link to the Drabbles category without adding the page to the category. |
[[:Category:Drabbles | drabble]] | drabble -- Creates a followable link to the Drabbles category that looks better in the middle of a sentence. |
<nowiki>[[Category:Drabbles]]</nowiki> | [[Category:Drabbles]] -- Plain text, with no link or category |
[edit] Sorting Subcategories
By default, subcategories on a category page will sort by alphabetical order. Usually, this is what we want. Sometimes, however, it's more helpful to sort them another way. For instance, the Doctor Who episodes category has a subcategory for each episode in which Jack appears (and for some that he didn't, but people might write stories about anyway), and the subcategories appear in the order they aired. in the Fanworks by Length category, subcategories are arranged in order of length, from microfics to epics.
To customize the order in which categories appear, use the pipe (|) again. Subcategories with piped text (a "sort key") will still sort by alphabetical order, but they will use the piped text instead of the category name to order themselves. The piped text should go beside the code for the parent category.
For instance, in the Torchwood Season 1 category, the individual episode subcategories appear in airdate order. The correct code to add the Cyberwoman episode subcategory to the Season 1 parent category is [[Category:Torchwood Season 1]], placed in the edit field of the Cyberwoman subcategory (and in the edit field of all the other season 1 episodes). However, this by itself would make the episode list sort in alphabetical order. Instead, for Cyberwoman, we use the code [[Category:Torchwood Season 1|TW 104]]. Everything Changes uses [[Category:Torchwood Season 1|TW 101]], Combat uses [[Category:Torchwood Season 1|TW 111]], etc. This forces the subcategories to sort according to their episode number instead of their name, when they appear under the Torchwood Season 1 parent category. It does not affect how they sort under any other parent category.
With that same example, you can tell just by looking at the page that the subcategories are using a sort key because they are all alphabetized under a "T" heading (for "TW XXX") instead of "E" for "episode." While that doesn't do any harm, it doesn't look ideal either. If there aren't very many subcategories in the list, you might want to get rid of the bold heading entirely. The Era: Early Season 1 and Radio Plays categories have only a handful of subcategories, and a bold heading would not only take up unneeded space, but would look awfully odd given that the subcategories use numbered sort keys. "Lost Souls" would appear under a "1" heading, for instance, and "The Dead Line" would appear under a "4" heading. To avoid that, we begin the sort key with a space (underscore). The sort key for "The Dead Line", for instance, isn't "4", it's " 4".
Spaces around the pipes do not matter when you're using them to rename a link, but they do matter when you use them as part of a sort key. If we wanted to get rid of the "T" headings in the Torchwood Season 1 category, for instance, we'd have to edit the code in each episode subcategory to include a space between the pipe and the sort key. This would make the wiki think they were alphabetized under " " instead of under "T", and the heading would vanish. Keep in mind that this is usually helpful only for relatively short lists. It wouldn't be helpful, for instance, for the headings in the authors category to vanish.
Note that for sort keys to work, you need to be very careful about applying them consistently to all the subcategories in a parent category. If you wanted to add another Doctor Who episode to the category here, for instance, you'd have to either use the same "DW XXX" type of sort key the other episodes already use or go back and edit all other subcategories to match the format of your new sort key. If you used either just the episode number without the "DW" or if you added the space before the "DW" to get rid of the heading, your new subcategory would not sort properly until you edited the other subcategories to match it or edited it to match them.
Sort keys can be helpful, but do think twice before using them. The default alphabetization will work well most of the time. If you use a sort order other than alphabetization, especially if you use spaces to remove the headings, make sure you pick an order that users will instinctively understand and that will make it easier, not harder, for them to find what they're looking for.