This high-risk template is indefinitely protected from editing to prevent vandalism.

Template:BookCat

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Template documentation[view] [edit] [history] [purge]

This template puts the page on which it's used ({{FULLPAGENAME}}) into appropriate categories, based on certain page-naming and page-categorization conventions.

Usage

When used without parameters, it

  • places subpages of a book in the book's category (Category:Book:{{BOOKNAME}}) and sorts them by chapter name.
  • places a book's templates in the book's template category (Category:Book:{{BOOKNAME}}/Templates). This only does the right thing if a book's templates begin with  Template:{{BOOKNAME}} .
  • places a book's template category in the book's category and in  Category:Book-specific templates .
  • places any other category in its parent, sorted by the category's last name. The parent has the same name except removing everything from the last slash on; and the last name is the part that was removed after that last slash. For example, Category:My Book/Images  would go in  Category:My Book  with sort key  Images .

Parameters

Optional parameter  filing=deep  changes the behavior on book pages, so that a book page with more than one slash in its name is placed in a subcategory of the category where its parent page would be placed, sorted by the page's last name. For example, using  {{BookCat|filing=deep}}  on page  My Book/Maps/Asia  would put that page in  Category:My Book/Maps  with sort key  Asia .

Optional parameter  template-filing=deep  changes the behavior on template pages to deep filing (so  Template:My book/Maps/Asia  would go in  Category:My book/Templates/Maps).

Optional parameter  sort or sortkey specifies a sort key to be used for categorization instead of relying on {{BOOKSORTKEY}}.

Optional first unnamed parameter is a full page name to use instead of the {{FULLPAGENAME}} of the current page.

An alternative template {{BookCat/diagnose}} reports the output of {{BookCat}} (with or without parameters) as an inert string, rather than categorizing the current page.

Examples

page where called result
Taxi Tongue/Dialogue 4

[[Category:Book:Taxi Tongue|Dialogue 4 ]]

Chess/Puzzles/Directmates

[[Category:Book:Chess|Puzzles/Directmates ]]

Wikijunior:Biology

[[Category:Book:Wikijunior:Biology| ]]

Wikijunior:Dinosaurs/Apatosaurus

[[Category:Book:Wikijunior:Dinosaurs|Apatosaurus ]]

Wikijunior talk:Bugs/Shield Bug

Category:Horticulture/Templates/Boxes

[[Category:Horticulture/Templates|Boxes ]]

Category:Book:Wikijunior:Solar System/Templates

[[Category:Book:Wikijunior:Solar System|Templates ]] [[Category:Book-specific templates|Wikijunior:Solar System ]]

Template:Wikijunior:Solar System/coolfacts

[[Category:Book:Wikijunior:Solar System/Templates|coolfacts ]]

User:Pi zero/Conlang/Beginner/Sounds

[[Category:Book:User:Pi zero/Conlang|Beginner/Sounds ]]

User:Pi zero/sandbox/Conlang/Beginner/Sounds

[[Category:Book:User:Pi zero/sandbox/Conlang|Beginner/Sounds ]]

Category:User:Pi zero/sandbox/Conlang/Beginner/Sounds

[[Category:User:Pi zero/sandbox/Conlang/Beginner|Sounds ]]

Template:User:Pi zero/sandbox/Conlang/Beginner/Sounds

[[Category:Book:User:Pi zero/sandbox/Conlang/Templates|Beginner/Sounds ]]

Shelf:Physical sciences

[[Category:Book:Wikibooks Stacks/Shelves|Physical sciences ]]

Template:Shelf:Page

[[Category:Book:Wikibooks Stacks/Templates|Page ]]

Template:Shelf:Page/display

[[Category:Book:Wikibooks Stacks/Templates|Page/display ]]

Internals

This template itself only contains the logic to sort out the identity of the target page; deducing the appropriate categorization is then delegated to {{BookCat/core}}. As of this writing, parameters assembled here are namespace, pagename, fullpagename, and sortkey; the first unnamed parameter is removed, and all other parameters are passed through to the subtemplate.

See also
https://en.wikibooks.org/wiki/Template:BookCat
en.wikibooks.org
crawl=CC-MAIN-2022-33
48758
application/http; msgtype=response
sha1:UBOIDKO6YCTCVVLVB234RUXYDVEBYM7C
<urn:uuid:fa630c4e-5267-4404-ab50-563bb860ad68>
2022-08-12T21:18:52Z
208.80.154.224
text/html
sha1:7K5R44FUZ2LZUT3QFZRNBFTIR634ICZ7
<urn:uuid:efa91853-8c34-44b4-89c1-09914bc4f2c7>
https://en.wikibooks.org/wiki/Template:BookCat
response
<urn:uuid:4358a859-24e0-40ea-869c-a344878f0b4d>
isPartOf: CC-MAIN-2022-33
publisher: Common Crawl
description: Wide crawl of the web for August 2022
operator: Common Crawl Admin (info@commoncrawl.org)
hostname: ip-10-67-67-227
software: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)
robots: checked via crawler-commons 1.4-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)
format: WARC File Format 1.1
conformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/