Template:Shelves
This template categorizes a book on one or more shelves in the Wikibooks Stacks, plus the book category.
Usage
Use this template only on the book's main page. Specify the names of the shelves as unnamed parameters, such as {{shelves|mathematics|science|etc}}
.
For non-shelf categories, such as descendants of Category:Books by type, use template {{categories}}.
On subpages of a book, use {{BookCat}}.
Internals
This template is responsible for adding books to the hidden allbooks categories, which allow automatic generation of lists of books belonging either to a given shelf or to any of its sub-shelves. When this template detects that it is being used on the main page of a book, for each shelf specified it calls {{shelves/leaf}}, via Module:TScope#map. This is why this template should only be used for shelf categories: {{shelves/leaf}} uses shelf pages to figure out which allbooks categories to add the book to, and if there are no shelf pages to consult, it reports the problem to Category:Book:Wikibooks Stacks/Attention needed. By using {{categories}} for non-subject categories, one avoids nuisance reports to Category:Book:Wikibooks Stacks/Attention needed.
The book is also added to hidden Category:Book:Wikibooks Stacks/Books; and, if no shelves are specified, to Category:Book:Wikibooks Stacks/Books/Unshelved.
If the template detects that it was called on a page that isn't the main page of a book, it does nothing.
This template can be induced to display diagnostic messages, explaining why it has put the page in Category:Book:Wikibooks Stacks/Attention needed, by specifying parameter diagnose=true
.
See also
- {{categories}} — adds book to non-subject categories
- {{alphabetical}} — adds book to alphabetical classification
- {{status}} — classifies book by completion status
- {{BOOKNAME}} — Returns the name of the book including the namespace