Template:Shelf:Get parent prefix/doc


This template determines the appropriate prefix for a parent of a shelf in the Wikibooks Stacks. The prefix may be Department: or Shelf:. Provide the unprefixed name of the parent as an unnamed parameter.


This template first attempts to ping the parent department, or, failing that, ping the parent shelf. Failing both of these, it uses #ifexist to determine whether the department page exists.

If the department ping indicates the department is properly set up, further checks are performed to determine whether the parent should be the department or a same-named shelf. If the current shelf has the same name as the department, the department is the parent (rather than the shelf being its own parent). If the parent gives a non-blank response to a reserved query, the department is the parent. Otherwise, the same-named shelf is the parent.

The deeper question of whether the deparment should exist is not addressed here; see {{Department:Listed?}}.