This template is used on subject pages to list books within that subject's respective category. Used on a subject page, it also handles queries to the subject page from other pages. For top-level subjects, use {{root subject}} instead.

Parameters

sunting
  • parent: specifies a parent subject, of which this subject is a member
  • parent2: optional, specifies a second parent subject for the subject page
  • description: specifies the description of the subject area the page will cover
  • namespace: optional, specifies which namespace should be searched through for books; defaults to the main namespace
  • show all staged: optional, specifies whether to list books at each completion level that are in descendant subjects as well as those in this subject; specifying no lists only those in this subject; specifying split lists first books in this subject, then books in descendants; any other non-blank value lists books in this subject and descendants as a single undifferentiated list; default is split
  • show all featured: optional, specifies whether to list featured books in descendant subjects as well as in this subject; specifying no lists only those in this subject; specifying split lists first books in this subject, then books in descendants; any other non-blank value lists books in this subject and descendants as a single undifferentiated list; default is split
  • maxcount: optional, specifies a requested maximum length of the book lists; default is the maximum supported directly by the extension (as of this writing, 200); request a larger number if it may be required for this subject; see {{DPL}}.
  • theme: optional, specifies the {{Robox}} theme for the description box; defaults to 15
  • theme2: optional, specifies the {{Robox}} theme for the book box; defaults to 3
  • icon: optional, specifies the logo displayed in the description box without the File: included; defaults to the Wikibooks logo
  • iconwidth: optional, specifies the width of the logo displayed in the description box with px included; defaults to 45px
  • 1: needs to be passed through from the calling subject page to this template, otherwise the subject category can't extract a subject description or full header
  • 2: optional, specifies how much information is allowed to be provided to the subject category; possible values are blank (no description or header), description (only provide a description) or header (provide a full header); note however that header does the same thing as omitting parameter 2, while blank does the same thing as omitting parameter 1

Copy-paste

sunting
Commonly-used Full
{{subject page
 |parent=
 |description=
 |1={{{1}}}
}}
{{subject page
 |parent=
 |parent2=
 |namespace=
 |show all staged=
 |show all featured=
 |maxcount=
 |theme=
 |theme2=
 |icon=
 |iconwidth=
 |description=
 |1={{{1}}}
 |2=
}}

Internals

sunting

This template itself only determines which sort of information request is being made, and either provides the information (if it isn't asking for a full subject display); or delegates the request to {{subject page/core}}, which is responsible for generating a full display. Delegation is done using Module:TScope#override, so that the subtemplate can tell which parameters were not provided, in order to supply default values for them.

When the transcluding page is in Subject: or Template: space, this template always delegates to produce a full display. In all other namespaces, ordinarily the template returns a string of the form /parent/parent2, where parent and parent2 are the parameter values specified to this template. This parentage information, easily parsed using magic word #titleparts:, allows other pages to navigate upward in the subject hierarchy. Before attempting to extract the parents this way, the caller verifies correct format of the result by passing it to template {{parsable}} — and if the format doesn't verify, the caller reports the problem to Category:Attention needed (allbooks).

Parameter 1 is used by the corresponding subject category to extract additional information for use in the category header. Value description requests a verbal description of the subject, in which case this template returns the value of its parameter description. Value header requests the full subject display, in which case this template delegates the task to {{subject page/core}}. Value mode asks which such information is recommended; the result returned is either description or header, indicating the named information is recommended, or blank indicating no such information is recommended (as would be the case if for some reason the information were not available). By default, this template returns mode header; but parameter 2 if provided overrides this default, allowing the subject to specify how much information the subject category should show.