Template:User book/doc

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

This userbox declares that the user contributes to a certain wikibook, and adds the user to a category associated with that book. The appearance of the userbox for a given book can be customized by that book.

Usage[edit source]

The template takes one required, unnamed parameter, which is the title of the book. For example,

{{User book|Using Wikibooks}}

would produce

This user contributes to the
Using Wikibooks wikibook.


The template adds the user to Category:Book:{{{1}}}/Users, where {{{1}}} is the title specified. In the example above, the user would be added to Category:Book:Using Wikibooks/Users. Calling the template with parameter nocat set to any non-null value will suppress this category, as in

{{User book|Using Wikibooks|nocat=1}}

Customization per book[edit source]

By default, the userbox looks like this:

This user contributes to the
[[]] wikibook.


To specify a different appearance for a book called Title, create a template called Template:Title/User book, containing markup

{{User book/Custom|{{{1}}}|{{{2}}}|...}}

where ... are named parameters that will be passed to template {{Userbox}}. The parameters supported are (as of this writing) all those documented for {{Userbox}} except info, usercategory2, and usercategory3. If usercategory is specified, it overrides the default name for the category; and if nocat is specified with a non-null value, it prevents the category from ever being used (so that it then doesn't matter whether or not the call to {{User book}} uses nocat).

For example, the userbox is customized for Wikijunior:Languages by means of {{Wikijunior:Languages/User book}}, so that

{{User book|Wikijunior:Languages}}

produces

This user contributes to the
Wikijunior:Languages wikibook.


A list of all these customizing templates is provided by Category:User book templates.

Internals[edit source]

If the book has no customizing user template, this template calls {{User book/Custom}}. If the book does have a customizing user template, this template calls that customizing template. Either way, the first unnamed parameter to the called template is the book name (the first unnamed parameter to this template); and the second unnamed parameter to the called template is the value of the nocat parameter to this template. {{User book/Custom}} suppresses categorization in response to either the second unnamed parameter or to parameter nocat.