Template:Subject page

From Wikibooks, open books for an open world
Jump to: navigation, search

< [[Subject:{{{parent}}}|{{{parent}}}]]purge this page's server cache

Subject page
{{{description}}}
Template documentation[edit] [history] [purge]

Usage

This template is used on subject pages to list books within that subject's respective category. For top-level subjects, use {{root subject}} instead.

Parameters

  • 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

Copy-paste

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

Internals

This template itself contains only interface logic: default values for parameters, and code to allow certain parameters to be extracted for use with allbooks categories. Internal code to implement the page layout is in template {{Subject page/core}}.

Parameter extraction is accomplished by transcluding the subject page from outside the Subject: and Template: namespaces. When this template detects that the transcluding page is not in either of those namespaces, it doesn't call the page layout sub-template {{Subject page/core}}; instead, it returns a string of the form /parent/parent2, where parent and parent2 are the parameter values specified to this template. Before attempting to extract parameters from the transcluded result, 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).