Template:Hatnote/doc

From Wikipedia

This template produces formatted text, following the guideline for a Wikipedia hatnote.

{{hatnote|Example hatnote text.}}

Broadly speaking, a hatnote should answer a readers' question (maybe preemptively): Am I on the right page?

Function[edit]

This template is primarily used to add a correctly formatted hatnote to a page. Often, but not always, this is a disambiguation link at the top of article pages. It places an HTML div- / div block around the text entered as its only argument, which provides standardized formatting (contents are indented and italicized in most displays); it also isolates the contained code to make sure that it is interpreted correctly.

This template is also used as the "meta-template" for additional specialized disambiguation link templates; see Category:Hatnote templates for a list.

The template does not automatically create links of any kind. Links and other desired formatting must be explicitly added, using normal Wikipedia markup.

Usage[edit]

Basic usage
{{hatnote|text}}
All parameters
{{hatnote|text|extraclasses=extra classes|selfref=yes|category=no}}

Parameters[edit]

This template accepts the following parameters:

  • 1 - the hatnote text. (required)
  • extraclasses - any extra CSS classes to be added. For example, the {{see also}} template adds the classes |extraclasses=boilerplate seealso.
  • selfref - if set to "yes", "y", "true" or "1", adds the CSS class "selfref". This is used to denote self-references to Wikipedia. See Template:Selfref for more information.
  • category - if set to "no", "n", "false", or "0", suppresses the error tracking category (Category:Hatnote templates with errors). This only has an effect if the first positional parameter (the hatnote text) is omitted.

Example[edit]

  • {{hatnote|Example hatnote text}}

Errors[edit]

If no hatnote text is supplied, the template will output the following message:

  • Error: no text specified (help).

If you see this error message, it is for one of four reasons:

  1. No parameters were specified (the template code was {{hatnote}}). Please use {{hatnote|text}} instead.
  2. Some parameters were specified, but the hatnote text wasn't included. For example, the template text {{hatnote|extraclasses=seealso}} will produce this error. Please use (for example) {{hatnote|text|extraclasses=seealso}} instead.
  3. The hatnote text was specified, but that text contains an equals sign ("="). The equals sign has a special meaning in template code, and because of this it cannot be used in template parameters that do not specify a parameter name. For example, the template code {{hatnote|2+2=4}} will produce this error. To work around this, you can specify the parameter name explictly by using 1= before the hatnote text, like this: {{hatnote|1=2+2=4}}.
  4. You tried to access Module:Hatnote directly by using {{#invoke:hatnote|hatnote|text}}. Use of #invoke in this way has been disabled for performance reasons. Please use {{hatnote|text}} instead.

If you see this error message and are unsure of what to do, please post a message on Template talk:Hatnote, and someone should be able to help you.

Pages that contain this error message are tracked in Category:Hatnote templates with errors.

Technical details[edit]

The HTML code produced by this template looks like this:

  • <div class="hatnote">hatnote text</div>

The code is produced by Module:Hatnote.


Hatnote templates[edit]

Hatnotes must be at the very top of the page or section.

Generic hatnote[edit]

  • {{Hatnote|CUSTOM TEXT}}
{{Hatnote|For other senses of this term, see [[etc…]]}}

If a link in a hatnote points to a disambiguation page, the link should include "(disambiguation)", even if that is a redirect. This indicates that the disambiguation link is intentional, and not an error (see WP:INTDABLINK):

Not {{hatnote|other uses|Springfield}}; but
{{hatnote|other uses|Springfield (disambiguation)}}, or
{{hatnote|other uses|Springfield (disambiguation)|Springfield}}

More pages on the same topic ("Further information ...")[edit]

"Main article: …"[edit]

{{Main}} is used to make summary style explicit, when used in a summary section for which there is also a separate article on the subject:

"For more details on …, see …"[edit]

{{Details}} can supplement {{Main}} in summary sections, or can indicate more details in nonsummary sections:

  • {{Details|PAGE1}}
  • {{Details|PAGE1|TOPIC}}

{{Details3}} allows changing the displayed name for links. Unlike {{Details}}, it requires bracketed link notation:

Alternatively, the {{!}} magic word can be used to change the displayed name for links:

"See also …"[edit]

Note: use only when OTHER TOPIC PAGE is related to current article and contains a self-explanatory parenthetical.

"Further information: …"[edit]

Other uses of the same title ("For …, see …")[edit]

"This page is about … For other uses …"[edit]

{{About}} is the main template for noting other uses.

Note. When used in main namespace, the word "page" in the following hatnotes is replaced by "article".

  • {{About|USE1}}
  • {{About|USE1||PAGE2}} (When the disambiguation page has a different name – Note the empty second parameter) →
  • {{About|USE1|USE2|PAGE2}} (When there is only one other use) →
  • {{About|USE1|USE2|PAGE2|and|PAGE3}} (Two pages for USE2) →
  • {{About|USE1|USE2|PAGE2#SUBSECTION{{!}}PAGE2TITLE}} (Using the {{!}} magic word to give the link a different title) →
  • {{About|USE1|USE2|PAGE2|USE3|PAGE3|USE4|PAGE4|USE5|PAGE5}} (When there are up to four other uses – You should generally create a disambiguation page at this point) →
  • {{About|USE1|USE2|PAGE2|USE3|PAGE3|other uses}} (When there are several standard other uses and also a disambiguation page with default name – Note that the last page name is not specified) →
  • {{About|USE1|USE2|PAGE2|USE3|PAGE3|other uses|PAGE4}} (When there are several standard other uses and also a disambiguation page with non-default name) →
  • {{About|USE1|USE2|PAGE2|USE3|PAGE3|other uses|PAGE4|and}}
  • {{About||USE2|PAGE2|USE3|PAGE3|other uses}} (When you don't need to state the focus of this article/page – Note the empty first parameter) →
  • {{About|||PAGE1|and|PAGE2}}
Note: {{for||PAGE1|PAGE2}} produces the same result.
Note: this hatnote says "section", instead of "article" or "page".

"This page is about … It is not to be confused with …"[edit]

{{About-distinguish}} is a template for noting other uses when there could be confusion with another topic.

"For …, see …"[edit]

{{For}} can be used instead of {{About}} so as not to display: This page is about USE1. but still specify a specific other use. This effect can also be achieved by using an empty first parameter in {{About}} as in:

For example: {{for|OTHER TOPIC|PAGE1}} is the same as {{About||OTHER TOPIC|PAGE1}} (note the empty first parameter).

However, it is somewhat clearer when using the {{For}} template, since the word "about" does not appear in the statement.

Variations
As with {{Other uses}}, there is a whole family of "for" templates. {{For2}} allows custom text, such as quotation marks or a link from part of the "CUSTOM TEXT"
  • {{For2|OTHER TOPIC|CUSTOM TEXT}}

"For other uses, see …"[edit]

When such a wordy hatnote as {{About}} is not needed, {{Other uses}} is often useful.

Variations
There are, historically, a whole family of "other uses" templates for specific cases. {{About}} is the standard hatnote for "other uses" and many of them can be specified using the {{About}} template. However, the individual templates may be easier to use in certain contexts.
Here are the variations and (when appropriate) the equivalents using the {{About}}, {{Other uses}} or {{For}} templates.
Note: adds "(disambiguation)" to whatever is input as the PAGE1.
Note: {{Other uses|PAGE1 (disambiguation)}} produces the same result.
Note: same as {{about}}, except it forces a second use to be noted if unspecified by parameters.

"For other uses of …, see …"[edit]

"… redirects here. For other uses, see …"[edit]

Variations
... Not to be confused with ...

Similar proper names ("For other people named ...")[edit]

Other people[edit]

Note: same as {{About}} except uses "other people" instead of "other uses" if only 1 parameter is used
Note: defaults to "named" as in {{Other people}}, exists for options like "nicknamed", "known as", etc.

Other places[edit]

Other ships[edit]

For articles on ships:

Distinguish[edit]

"Not to be confused with …"[edit]

"… redirects here. It is not to be confused with …"[edit]

"For technical reasons, … redirects here. For … , see … ."[edit]

Family names[edit]

Miscellaneous (hurricanes, Pope Stephen, Wiki selfref)[edit]

These hatnotes are topic-specific. They are documented at their template page.

Categories[edit]

Category-specific templates:

This is a template for linking categories horizontally. Horizontal linkage is often the right solution when vertical linkage (i.e., as sub-category and parent category) is not appropriate. In most cases, this template should be used on both categories to create reciprocal linkage between the two categories.

Lists[edit]

User pages[edit]

Template:This user talk

Notes[edit]

These templates are used in thousands of articles; therefore, changing the syntax could break thousands of articles. If you wish to create or edit a disambiguation or redirection template, first ask yourself the following questions:

  1. Is there already a template that will do this job? Since many disambiguation and redirection templates have already been created, first check: Category:Disambiguation and redirection templates.
  2. Do I really need a new template for this? Will it likely be used on any other articles or should I just use {{Hatnote}} instead? Before creating a new template, see the template namespace guideline.
  3. If I change the parameters around on an existing template, do I know what the result will be? Will it break existing uses of the template and if so, can I fix all of the errors? Before making any changes, see Template sandbox and test cases.

See also[edit]