# Using Wikibooks/Shelves, Categories, and Classifications

If you've read Finding A Wikibook, then you see that there are many ways to find a Wikibook on the topic of your choice. However, whether starting a new book or expanding heavily on a book that is merely a stub, you need to ensure that your book is visible to both readers and potential contributors. The terminology used in Wikibooks for the various methods of organization can be confusing, and the proper implementation of those methods on your book can be hard to grasp. After reading the following sections you should have a better idea how this all works.
To help make the entire book visible to readers and potential contributors, most books have:
* the template {{BookCat}} on the bottom of every page in the book, except the main page.
* The template {{Shelves|Shelfname1|Shelfname2|...}} on the bottom of the book's main page (see below for a detailed explanation).
* The template {{BookCat}} at the bottom of the book's category page.
* The template {{Book category header}} at the top of the book's category page.
* The template {{BookCat}} or, in some cases, {{Book item category header}} on subcategory pages of the book's category.

## Shelves and categories

As a reader, browsing the shelves allows you to find books on the topic of your choice. As a writer, you have an interest in having your book appear on the shelf of your choice. The shelf contents are dynamically generated, meaning you cannot add your book to a shelf directly to have it appear there. Each shelf page has wiki markup in it that specifies a certain category to look in for pages that will be then displayed on the shelf. When you file your book's main page in that special category, it will appear on the corresponding shelf, and on larger shelves covering wider topics that encompass the topic of the smaller shelf. The details of how to do this are explained later.
The pages of your book also need to be filed in a category, but they should not be filed in the special category that matches up to the shelf in which you are filing the main page of your book. If they were, every page of your book would show up separately on the shelf, flooding the shelf display so it wouldn't be useful at all. Instead, they should be filed in a category whose name is based on the title of your book. The details of this are explained below.
Keeping these two types of categories straight is important. The category a book's main page is filed in is referred to as a shelf category, since anything filed in it appears on a shelf page. The category the rest of the book's pages are filed in is referred to as a book category, since everything filed in it should pertain only to a single book. Several naming conventions prevent confusion between book categories and shelf categories.
The name of a shelf category has a Shelf: prefix, followed by exactly the name of the corresponding shelf; the name of a book category has a Book: prefix, and is otherwise exactly the name of the book's main page. Also, by convention, normally shelves are named using Sentence case while books are titled using Title Case. For example, there is (as of this writing) a book Emergency Medicine and a shelf Emergency medicine; the book main page is Emergency Medicine, the shelf page is Shelf:Emergency medicine, the book category is Category:Book:Emergency Medicine, and the shelf category is Category:Shelf:Emergency medicine.

## Filing your book's main page

Your book's main page is key to having your book be found by those who would have an interest in it. Several pieces of code need to be added to it for your book to appear both on shelf pages and on pages used for other methods of finding books.

### Shelf category

If you have spent the time determining your book's subject matter and scope, then you will have an easier time determining what shelf category to file it in. At the top level, all the shelves are grouped into 12 departments. Most of the top-level shelves within a department have subshelves within them, perhaps a given subshelf may have further subshelves within it, and so on. Although most departments do have a shelf with the same name as the department, containing general references, usually when your book seems to belong on that general-references shelf you should consider narrowing the scope of the book.
A book should be placed on the most-specific shelf possible, and usually only needs to be placed on one shelf. A more specific shelf is one of many that are encompassed by a less specific shelf, so there is no need to file a book in both. For instance, a book filed on Shelf:Constructed languages does not also need to be filed on Shelf:Languages since the former is one of many shelves that are contained within the latter.
Also, file your book based on the topic it actually covers and not topics that would only be related tangentially. For example, a book filed on Shelf:Educational software should not be filed on Shelf:Microsoft Windows as well simply because it covers a program that runs on Windows.
The hard part is figuring out what shelf best matches your book's content. The easy part is actually putting the main page in the shelf category that corresponds to the most-specific shelf you want it to show up on. Simply place {{Shelves|Foo}} or {{Shelves|Foo|Bar}} on the bottom of your book's main page, where Foo and Bar are shelf names. As mentioned earlier, less is more, so do not overdo it.

### Alphabetical classification

The alphabetical classification system allows people to search for a book by the first letter or number in its title. This is especially helpful if someone is looking for several books on the same topic that all start out with the same first word in the title.
The easiest of all the methods you have at your disposal for filing your book, simply add {{Alphabetical|*}} to the bottom of your book's main page, where * is the first letter or number in your book's title. Use your discretion as to whether to count the words "A" or "The" as the first words of your title for the purposes of filing. Ideally, if those words are not necessary, they should not be added to the beginning of the title in the first place.

## Filing your book's chapters and pages

The rest of the pages of your book should not have any of the above bits of code added to them. They need to be filed, either directly or indirectly, in the book category of your book. Directly means they are filed specifically in that category, while indirectly means they are filed in another category that is itself filed in your book's category. Placing all your pages into a book category allows for an alphabetical index of pages to complement your book's table of contents, without having to generate such an index manually. When you create a new page in your book and add it to your book's category, it automatically appears in this index.
As you learned in How To Structure A Wikibook, your pages can be structured using a flat method or one using chapters. How you file the pages within your book's category also depends on personal preference and the conventions used by your book.

### Flat filing

The simplest method of filing your book's pages is to put them all in the book category directly. If your book's name is Foo Bar the category would be Category:Book:Foo Bar. This could be done with [[Category:Book:Foo Bar]]. This is not the ideal option, however.
The pages should be sorted within the category to make it easier to locate them. If you do not specify the method of this sorting, they will all show up under the first letter of your book's name. Continuing the example of Foo Bar, all the pages would show up under F. Rather than manually specifying sorting on a per-page basis, use the {{BookCat}} template at the bottom of every page to sort the page based on the portion after the title. Foo Bar/Blah would be sorted based on Blah. You can also add {{BookCat}} in a template included on all your pages for the same effect.
You will notice that the category added to the bottom of the pages is red. You need to click it and create the category before it will exist. Simply call templates {{book category header}} and {{BookCat}} on the new page; the first of these templates will generate a message linking to the book's main page, and the second template will file your book's category in the shelf category(-ies) that your book's main page is filed in. The shelf pages do not list categories, only pages, so this allows people viewing a shelf's corresponding category to see both your book's main page and your book's individual category.

### Book item categories

If your book has peripheral pages associated with it, such as templates or images, that aren't subpages of the book's main page, you should keep track of these using subcategories of the book's category, one subcategory for each kind of peripheral page. This sort of peripheral subcategory should be named with the book category name followed by a slash and the kind of peripheral, capitalized. For example, if your book is called My Book, so that its book category is Category:Book:My Book, a subcategory for gizmos associated with the book should be called Category:Book:My Book/Gizmos. Create the peripheral subcategory containing a call to template {{book item category header}}, which will automatically file the subcategory in the book category and generate a header explaining what the subcategory is. For some kinds of peripherals, {{book item category header}} also knows to file the subcategory in one or another reserved administrative category.
Usually, peripheral templates of a book are named Template:, the name of a book, and possibly a slash and a specific name. Book My Book might have a template Template:My Book/Device, or perhaps one called Template:My Book if the purpose of the template is especially universal to the book. Templates with names like these can be filed by putting {{BookCat}} on the template, which will ignore the Template: portion of their name and sort them into a /Templates subcategory.
Images don't follow this sort of naming convention. For these, use [[{{BOOKCATEGORY|<title>}}/Images]], where <title> is the name of your book, such as [[{{BOOKCATEGORY|My Book}}/Images]]. You can also use {{BOOKCATEGORY|<title>}} this way for templates that don't follow the usual naming convention but are associated with a particular book.
You may also use subcategories like this for some supplementary grouping(s) of its pages, independent of its table of contents, such as stubs. Use {{book item category header}} on the subcategory — especially if it's for stubs, because the template automatically knows to put those in a reserved administrative category — and [[{{BOOKCATEGORY}}/Stubs|{{BOOKSORTKEY}}]] (or /Gizmos, etc.) on the selected book pages to file them there. Usually this is done by a template, such as Template:My Book/Stub. (When {{BOOKCATEGORY}} and {{BOOKSORTKEY}} are used on a page of the book, they don't need to be told the name of the book since they can figure it out from the name of the page.)

### Deep filing (advanced)

If you have structured your book using chapters and a deep structure, you may have hundreds of pages. That many pages in your book's category can become unwieldy. The more advanced option is to file pages within each chapter inside separate categories that are in turn filed in your book's category. This technique can be understood better by using an example. Take a book with the following pages (not as many as would actually be used for this method):
My Book :
| My Book/Foo | My Book/Bar |
| My Book/Foo/Page | My Book/Bar/Page |
Category:Book:My Book would still exist and be filed in the same shelf category as the book, as with flat filing. However, additional categories would be created for all the pages under Foo and Bar, with those categories filed in Category:Book:My Book. Pages within the Foo chapter would be in Category:Book:My Book/Foo and pages within the Bar chapter would be in Category:Book:My Book/Bar.
The code used for this method is similar to that used in the flat filing method. Add {{BookCat|filing=deep}} to the bottom of the pages or in a template placed on all the pages, which will automatically file the pages into subcategories of the root book category. The pages will be sorted based on the first letter of the page rather than the first letter of the chapter, and all the pages within the same chapter are inside a unique category.
When creating the categories for each chapter's pages by clicking the red link that appears at the bottom of the page, add the category to the book's category with {{BookCat}}. This puts the chapter category into the book's category and sorts it based on the chapter's name, rather than the first letter of the book's name.
To conclude the demonstration by example, Category:Book:My Book would end up looking like the following using deep filing:
    Category:Book:My Book
       My Book
       My Book/Foo
       My Book/Bar
       Category:Book:My Book/Foo
          My Book/Foo/Page
       Category:Book:My Book/Bar
          My Book/Bar/Page
       Category:Book:My Book/Images
       Category:Book:My Book/Templates
← How To Structure A Wikibook · Using Wikibooks · Attracting Readers →