Template:Shelf:Get parent prefix/doc

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

Internals
This template first attempts to ping the parent department, or, failing that, ping the parent shelf. Failing both of these, it uses  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  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?.