Templat:Subject page
/{{{parent}}}/
This template is used on 4,000+ pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
Usage
suntingThis 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
suntingparent
: specifies a parent subject, of which this subject is a memberparent2
: optional, specifies a second parent subject for the subject pagedescription
: specifies the description of the subject area the page will covernamespace
: optional, specifies which namespace should be searched through for books; defaults to the main namespaceshow all staged
: optional, specifies whether to list books at each completion level that are in descendant subjects as well as those in this subject; specifyingno
lists only those in this subject; specifyingsplit
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 issplit
show all featured
: optional, specifies whether to list featured books in descendant subjects as well as in this subject; specifyingno
lists only those in this subject; specifyingsplit
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 issplit
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 15theme2
: optional, specifies the {{Robox}} theme for the book box; defaults to 3icon
: optional, specifies the logo displayed in the description box without theFile:
included; defaults to the Wikibooks logoiconwidth
: optional, specifies the width of the logo displayed in the description box withpx
included; defaults to 45px1
: 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 header2
: 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) orheader
(provide a full header); note however thatheader
does the same thing as omitting parameter2
, while blank does the same thing as omitting parameter1
Copy-paste
suntingCommonly-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
suntingThis 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.