Difference between revisions of "Module:Yesno"

From PKC
Jump to navigation Jump to search
(Undid revision 948472533 by [[Special:Contributions/w>Vogone|w>Vogone]] ([[User talk:w>Vogone|talk]]))
 
m (1 revision imported)
 
(No difference)

Latest revision as of 15:21, 28 June 2021

Template:Sandbox other

This module provides a consistent interface for processing boolean or boolean-style string input. While Lua allows the true and false boolean values, wikicode templates can only express boolean values through strings such as "yes", "no", etc. This module processes these kinds of strings and turns them into boolean input for Lua to process. It also returns nil values as nil, to allow for distinctions between nil and false. The module also accepts other Lua structures as input, i.e. booleans, numbers, tables, and functions. If it is passed input that it does not recognise as boolean or nil, it is possible to specify a default value to return.

Syntax

yesno(value, default)

value is the value to be tested. Boolean input or boolean-style input (see below) always evaluates to either true or false, and nil always evaluates to nil. Other values evaluate to default.

Usage

First, load the module. Note that it can only be loaded from other Lua modules, not from normal wiki pages. For normal wiki pages you can use Template loop detected: Template:Documentation subpage

Description

The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.

For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.

Usage

Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"): {{distinguish|Foo}}Template loop detected: Template:Distinguish


This hatnote can be used to distinguish the topic from multiple other topics: {{distinguish|Foo|Bar}}Template loop detected: Template:Distinguish {{distinguish|Foo|Bar|Gaz}}Template loop detected: Template:Distinguish


It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped: {{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}Template loop detected: Template:Distinguish

Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].

It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.

When to use

This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:

Coma
Template loop detected: Template:Distinguish

Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.

However, {{distinguish}} is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:

Template:Cross Reversi
Template loop detected: Template:Distinguish

In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.

In this case you should use {{about}} instead of {{distinguish}}. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.

Template:Tick Reversi
Template:About

{{Distinguish}} should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools; click here to see a monthly parameter usage report for this template.

TemplateData for Yesno

Template:Template other

A hatnote used when there is an ambiguity in an article's title.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Name of article1

Name of article that you want to link to

Page namesuggested
Optional additional article to link (2)2

Optional additional article to link

Page nameoptional
Optional additional article to link (3)3

Optional additional article to link

Page nameoptional
Optional additional article to link (4)4

Optional additional article to link

Page nameoptional
Custom texttext

Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]."

Stringoptional
Self referenceselfref

If set, marks note as being a self reference, to not be shown when content is reused

Booleanoptional

Redirects

See also

Template:Hatnote templates

Template:Sandbox other This template displays a message that the current page is a documentation subpage.

Usage

{{Documentation subpage}}
or
{{Documentation subpage|[[Template:Var]]}}



Template:Example needed

Userbox documentation

To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:

{{Userbox documentation subpage}}
or
{{Userbox documentation subpage|[[Template:Var]]}}

Text customization

The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1: Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end

Other parameters

Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)

Display

This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:

  • On a /doc page, it displays a box explaining template documentation and links to the template page.
  • On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains Template loop detected: Template:Template link) will automatically note that the documentation is transcluded from a subpage.

Functions

In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".

See also

Template:Sandbox other Template:Redirect-distinguishLua error: expandTemplate: template "No redirect" does not exist.

The template link template is a simple macro template used to display a template name as a link surrounded by braces, thus showing the template name as code rather than actually invoking it. Its primary use is in instruction and documentation where it is used to refer to a template by name without invoking it.

Note that this template may be used under the name "tee-el" (tl) as well as "tee-one" (t1)— both function the same way and produce the same results. This is not true for all such visually confusing templates containing a possible 1/l mix-up: and are not interchangeable.

Template loop detected: Template:Tl works exactly like Template loop detected: Template:Tl with the addition of optionally displaying alternative label text (link label). Template loop detected: Template:Tl can include the use of parameters in the template (as {{{1}}}).

Examples

A short example of its use is:

{{tl|Example}}
which generates
Template loop detected: Template:Tl

Other longer examples:

Code Result Notes
{{tl|Void}} Template loop detected: Template:Tl Standard usage
{{tls|Example}} Template:Tls For templates that should be substituted
{{tl2|X1}} Template:Tl2 This formats the link to show how it would look in code (i.e., monospace font)
{{tl2|sisterTemplate:=M:|3x}} {{3x}} Same as above, for templates on another Wikimedia project (in this example, Meta, using m:). See Interwiki codes.
{{tl2|sisterTemplate:=wikibooks|langTemplate:=de:|WP}} {{WP}} For templates on another language project
{{tl|1==)}} Template loop detected: Template:Tl Use the format {{tl|1=templatename}} if the template contains template coding characters such as Template loop detected: Template:Tl or Template loop detected: Template:Tl

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools; click here to see a monthly parameter usage report for this template.

TemplateData for Yesno

Template:Template other

This template displays a template name as a link surrounded by braces, thus showing how the template name would be used in code. Its primary use is in instruction and documentation.

Template parameters

ParameterDescriptionTypeStatus
template name1

positional parameter: the template name without the namespace prefix “Template:”, which is added automatically

Linerequired

See also

Description

The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.

For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.

Usage

Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"): {{distinguish|Foo}}Template loop detected: Template:Distinguish


This hatnote can be used to distinguish the topic from multiple other topics: {{distinguish|Foo|Bar}}Template loop detected: Template:Distinguish {{distinguish|Foo|Bar|Gaz}}Template loop detected: Template:Distinguish


It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped: {{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}Template loop detected: Template:Distinguish

Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].

It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.

When to use

This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:

Coma
Template loop detected: Template:Distinguish

Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.

However, {{distinguish}} is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:

Template:Cross Reversi
Template loop detected: Template:Distinguish

In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.

In this case you should use {{about}} instead of {{distinguish}}. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.

Template:Tick Reversi
Template:About

{{Distinguish}} should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools; click here to see a monthly parameter usage report for this template.

TemplateData for Yesno

Template:Template other

A hatnote used when there is an ambiguity in an article's title.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Name of article1

Name of article that you want to link to

Page namesuggested
Optional additional article to link (2)2

Optional additional article to link

Page nameoptional
Optional additional article to link (3)3

Optional additional article to link

Page nameoptional
Optional additional article to link (4)4

Optional additional article to link

Page nameoptional
Custom texttext

Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]."

Stringoptional
Self referenceselfref

If set, marks note as being a self reference, to not be shown when content is reused

Booleanoptional

Redirects

See also

Template:Hatnote templates

Template:Sandbox other This template displays a message that the current page is a documentation subpage.

Usage

{{Documentation subpage}}
or
{{Documentation subpage|[[Template:Var]]}}



Template:Example needed

Userbox documentation

To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:

{{Userbox documentation subpage}}
or
{{Userbox documentation subpage|[[Template:Var]]}}

Text customization

The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1: Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end

Other parameters

Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)

Display

This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:

  • On a /doc page, it displays a box explaining template documentation and links to the template page.
  • On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains Template loop detected: Template:Template link) will automatically note that the documentation is transcluded from a subpage.

Functions

In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".

See also

Template:Sandbox other

Template:Big

Usage

Template:Dated maintenance category

Template:Confusing

See also

Template:Navbar

General-purpose formatting

Comparison of template-linking templates according to the styles of generated text and link produced
Text style ↓ {{tlg}} optionsTemplate:NoteTag
to achieve text style
Link style
Linked Unlinked Linked with subst Unlinked with subst Linked including braces Linked with alternative text
{{tlg}} optionsTemplate:NoteTag
to achieve link style
Template:N/a Template:N/a Template:Code Template:Code nolink=yes|subst=yes Template:Code Template:Code
Template:Code
normal Template:N/a Template:NowrapTemplate:NoteTag
Template loop detected: Template:Tl
Template:TlpTemplate:NoteTag
Template:TluTemplate:NoteTag
{{tlf}}Template:NoteTag
<template link>
Template:Tls
Template:TlsuTemplate:NoteTag
{{tlsf}}Template:NoteTag
<template link>
Template:Tn Template:Tla
code Template:Code Template:Tl2
{{tlx}}
Template:TlxuTemplate:NoteTag
{{tlc}}Template:NoteTag
<template link>
Template:Tnull<template link>
Template:Tlxs Template:TlscTemplate:NoteTag
<template link>
colspan="2" rowspan="3" Template:N/a
monospace Template:CodeTemplate:NoteTag colspan="2" rowspan="2" Template:N/a Template:TltssTemplate:NoteTag rowspan="2" Template:N/a
kbd Template:CodeTemplate:NoteTag
bold Template:Code Template:Tlb colspan="5" rowspan="3" Template:N/a
bold+code bold=yes|code=yes Template:Tlxb
italic+code italic=yes|code=yes Template:Tlxi

Template:NoteFoot Template:Clear

Other formatting templates

Templates producing specialised formatting effects for given templates, modules or parameters
Code example Effect Notes
{{tl2|Hatnote|lang=fr}} Template:Tl2 Supports linking to sister projects (e.g., fr:Hatnote)
{{tlu|User:Ahunt/SSHFS}} Template:Tlu Supports linking to any namespace
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}} Template:Demo Shows code and example
{{xpd|Hatnote|Some hatnote text}} Template:Xpd Shows code, example and a link to expand the template code
{{tln|Hatnote}} Template:Tln Produces a normal link to the template
{{elc|Template:Hatnote}}
{{elc|Template:Hatnote|Hatnote}}
Template:Elc
Template:Elc
Formats wikilink, with optional piped link text and blended suffix
{{ml|Example|hello}} Template:Ml Counterpart to Template loop detected: Template:Tl for linking to Lua modules
{{mlx|Example|hello}} Template:Mlx Counterpart to Template loop detected: Template:Tl for linking to Lua modules
{{para|title|<var>book title</var>}} Template:Para Formats template parameters for display, with or without values
{{sclx|LASTING}} Template:Sclx Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag.
{{tag|ref}}
{{xtag|templatedata}}
Template:Tag
Template:Xtag
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing
{{dtl|Ping project}} Template:Dtl Wikidata counterpart to Template loop detected: Template:Tl
{{pf|if}}
{{pf|if|{{{1}}}|true|false}}
Template:Pf
Template:Pf
Parser function equivalent to Template loop detected: Template:Tl
{{magic word|uc:}} Template:Magic word Magic word links

With utility links

Templates producing utility links for a given template (Hatnote used here as example)
Code example Effect
{{lt|Hatnote}} Template:Lt
{{lts|Hatnote}} Template:Lts
{{t links|Hatnote}} Template:T links
{{tfd links|Hatnote}} Template:Tfd links
{{tetl|Hatnote}} Template:Tetl
{{tsetl|Hatnote}} Template:Tsetl
{{ti|Hatnote}} Template:Ti
{{tic|Hatnote}} Template:Tic
{{tim|Hatnote}} Template:Tim
{{tiw|Hatnote}} Template loop detected: Template:Tiw
{{tlt|Hatnote}} Template:Tlt
{{ttl|Hatnote}} Template:Ttl
{{twlh|Hatnote}} Template:Twlh

Template:Sandbox other

Description

The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.

For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.

Usage

Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"): {{distinguish|Foo}}Template loop detected: Template:Distinguish


This hatnote can be used to distinguish the topic from multiple other topics: {{distinguish|Foo|Bar}}Template loop detected: Template:Distinguish {{distinguish|Foo|Bar|Gaz}}Template loop detected: Template:Distinguish


It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped: {{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}Template loop detected: Template:Distinguish

Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].

It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.

When to use

This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:

Coma
Template loop detected: Template:Distinguish

Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.

However, {{distinguish}} is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:

Template:Cross Reversi
Template loop detected: Template:Distinguish

In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.

In this case you should use {{about}} instead of {{distinguish}}. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.

Template:Tick Reversi
Template:About

{{Distinguish}} should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools; click here to see a monthly parameter usage report for this template.

TemplateData for Yesno

Template:Template other

A hatnote used when there is an ambiguity in an article's title.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Name of article1

Name of article that you want to link to

Page namesuggested
Optional additional article to link (2)2

Optional additional article to link

Page nameoptional
Optional additional article to link (3)3

Optional additional article to link

Page nameoptional
Optional additional article to link (4)4

Optional additional article to link

Page nameoptional
Custom texttext

Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]."

Stringoptional
Self referenceselfref

If set, marks note as being a self reference, to not be shown when content is reused

Booleanoptional

Redirects

See also

Template:Hatnote templates

Template:Sandbox other This template displays a message that the current page is a documentation subpage.

Usage

{{Documentation subpage}}
or
{{Documentation subpage|[[Template:Var]]}}



Template:Example needed

Userbox documentation

To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:

{{Userbox documentation subpage}}
or
{{Userbox documentation subpage|[[Template:Var]]}}

Text customization

The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1: Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end

Other parameters

Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)

Display

This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:

  • On a /doc page, it displays a box explaining template documentation and links to the template page.
  • On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains Template loop detected: Template:Template link) will automatically note that the documentation is transcluded from a subpage.

Functions

In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".

See also

Template:Sandbox other

Template:Big

Usage

Template:Dated maintenance category

Template:Confusing

See also

Template:Navbar

General-purpose formatting

Comparison of template-linking templates according to the styles of generated text and link produced
Text style ↓ {{tlg}} optionsTemplate:NoteTag
to achieve text style
Link style
Linked Unlinked Linked with subst Unlinked with subst Linked including braces Linked with alternative text
{{tlg}} optionsTemplate:NoteTag
to achieve link style
Template:N/a Template:N/a Template:Code Template:Code nolink=yes|subst=yes Template:Code Template:Code
Template:Code
normal Template:N/a Template:NowrapTemplate:NoteTag
Template loop detected: Template:Tl
Template:TlpTemplate:NoteTag
Template:TluTemplate:NoteTag
{{tlf}}Template:NoteTag
<template link>
Template:Tls
Template:TlsuTemplate:NoteTag
{{tlsf}}Template:NoteTag
<template link>
Template:Tn Template:Tla
code Template:Code Template:Tl2
{{tlx}}
Template:TlxuTemplate:NoteTag
{{tlc}}Template:NoteTag
<template link>
Template:Tnull<template link>
Template:Tlxs Template:TlscTemplate:NoteTag
<template link>
colspan="2" rowspan="3" Template:N/a
monospace Template:CodeTemplate:NoteTag colspan="2" rowspan="2" Template:N/a Template:TltssTemplate:NoteTag rowspan="2" Template:N/a
kbd Template:CodeTemplate:NoteTag
bold Template:Code Template:Tlb colspan="5" rowspan="3" Template:N/a
bold+code bold=yes|code=yes Template:Tlxb
italic+code italic=yes|code=yes Template:Tlxi

Template:NoteFoot Template:Clear

Other formatting templates

Templates producing specialised formatting effects for given templates, modules or parameters
Code example Effect Notes
{{tl2|Hatnote|lang=fr}} Template:Tl2 Supports linking to sister projects (e.g., fr:Hatnote)
{{tlu|User:Ahunt/SSHFS}} Template:Tlu Supports linking to any namespace
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}} Template:Demo Shows code and example
{{xpd|Hatnote|Some hatnote text}} Template:Xpd Shows code, example and a link to expand the template code
{{tln|Hatnote}} Template:Tln Produces a normal link to the template
{{elc|Template:Hatnote}}
{{elc|Template:Hatnote|Hatnote}}
Template:Elc
Template:Elc
Formats wikilink, with optional piped link text and blended suffix
{{ml|Example|hello}} Template:Ml Counterpart to Template loop detected: Template:Tl for linking to Lua modules
{{mlx|Example|hello}} Template:Mlx Counterpart to Template loop detected: Template:Tl for linking to Lua modules
{{para|title|<var>book title</var>}} Template:Para Formats template parameters for display, with or without values
{{sclx|LASTING}} Template:Sclx Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag.
{{tag|ref}}
{{xtag|templatedata}}
Template:Tag
Template:Xtag
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing
{{dtl|Ping project}} Template:Dtl Wikidata counterpart to Template loop detected: Template:Tl
{{pf|if}}
{{pf|if|{{{1}}}|true|false}}
Template:Pf
Template:Pf
Parser function equivalent to Template loop detected: Template:Tl
{{magic word|uc:}} Template:Magic word Magic word links

With utility links

Templates producing utility links for a given template (Hatnote used here as example)
Code example Effect
{{lt|Hatnote}} Template:Lt
{{lts|Hatnote}} Template:Lts
{{t links|Hatnote}} Template:T links
{{tfd links|Hatnote}} Template:Tfd links
{{tetl|Hatnote}} Template:Tetl
{{tsetl|Hatnote}} Template:Tsetl
{{ti|Hatnote}} Template:Ti
{{tic|Hatnote}} Template:Tic
{{tim|Hatnote}} Template:Tim
{{tiw|Hatnote}} Template loop detected: Template:Tiw
{{tlt|Hatnote}} Template:Tlt
{{ttl|Hatnote}} Template:Ttl
{{twlh|Hatnote}} Template:Twlh

Template:Sandbox other

Description

The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.

For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.

Usage

Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"): {{distinguish|Foo}}Template loop detected: Template:Distinguish


This hatnote can be used to distinguish the topic from multiple other topics: {{distinguish|Foo|Bar}}Template loop detected: Template:Distinguish {{distinguish|Foo|Bar|Gaz}}Template loop detected: Template:Distinguish


It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped: {{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}Template loop detected: Template:Distinguish

Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].

It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.

When to use

This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:

Coma
Template loop detected: Template:Distinguish

Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.

However, {{distinguish}} is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:

Template:Cross Reversi
Template loop detected: Template:Distinguish

In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.

In this case you should use {{about}} instead of {{distinguish}}. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.

Template:Tick Reversi
Template:About

{{Distinguish}} should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools; click here to see a monthly parameter usage report for this template.

TemplateData for Yesno

Template:Template other

A hatnote used when there is an ambiguity in an article's title.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Name of article1

Name of article that you want to link to

Page namesuggested
Optional additional article to link (2)2

Optional additional article to link

Page nameoptional
Optional additional article to link (3)3

Optional additional article to link

Page nameoptional
Optional additional article to link (4)4

Optional additional article to link

Page nameoptional
Custom texttext

Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]."

Stringoptional
Self referenceselfref

If set, marks note as being a self reference, to not be shown when content is reused

Booleanoptional

Redirects

See also

Template:Hatnote templates

Template:Sandbox other This template displays a message that the current page is a documentation subpage.

Usage

{{Documentation subpage}}
or
{{Documentation subpage|[[Template:Var]]}}



Template:Example needed

Userbox documentation

To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:

{{Userbox documentation subpage}}
or
{{Userbox documentation subpage|[[Template:Var]]}}

Text customization

The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1: Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end

Other parameters

Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)

Display

This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:

  • On a /doc page, it displays a box explaining template documentation and links to the template page.
  • On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains Template loop detected: Template:Template link) will automatically note that the documentation is transcluded from a subpage.

Functions

In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".

See also

Template:Sandbox other

Template:Big

Usage

Template:Dated maintenance category

Template:Confusing

See also

Template:Navbar

General-purpose formatting

Comparison of template-linking templates according to the styles of generated text and link produced
Text style ↓ {{tlg}} optionsTemplate:NoteTag
to achieve text style
Link style
Linked Unlinked Linked with subst Unlinked with subst Linked including braces Linked with alternative text
{{tlg}} optionsTemplate:NoteTag
to achieve link style
Template:N/a Template:N/a Template:Code Template:Code nolink=yes|subst=yes Template:Code Template:Code
Template:Code
normal Template:N/a Template:NowrapTemplate:NoteTag
Template loop detected: Template:Tl
Template:TlpTemplate:NoteTag
Template:TluTemplate:NoteTag
{{tlf}}Template:NoteTag
<template link>
Template:Tls
Template:TlsuTemplate:NoteTag
{{tlsf}}Template:NoteTag
<template link>
Template:Tn Template:Tla
code Template:Code Template:Tl2
{{tlx}}
Template:TlxuTemplate:NoteTag
{{tlc}}Template:NoteTag
<template link>
Template:Tnull<template link>
Template:Tlxs Template:TlscTemplate:NoteTag
<template link>
colspan="2" rowspan="3" Template:N/a
monospace Template:CodeTemplate:NoteTag colspan="2" rowspan="2" Template:N/a Template:TltssTemplate:NoteTag rowspan="2" Template:N/a
kbd Template:CodeTemplate:NoteTag
bold Template:Code Template:Tlb colspan="5" rowspan="3" Template:N/a
bold+code bold=yes|code=yes Template:Tlxb
italic+code italic=yes|code=yes Template:Tlxi

Template:NoteFoot Template:Clear

Other formatting templates

Templates producing specialised formatting effects for given templates, modules or parameters
Code example Effect Notes
{{tl2|Hatnote|lang=fr}} Template:Tl2 Supports linking to sister projects (e.g., fr:Hatnote)
{{tlu|User:Ahunt/SSHFS}} Template:Tlu Supports linking to any namespace
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}} Template:Demo Shows code and example
{{xpd|Hatnote|Some hatnote text}} Template:Xpd Shows code, example and a link to expand the template code
{{tln|Hatnote}} Template:Tln Produces a normal link to the template
{{elc|Template:Hatnote}}
{{elc|Template:Hatnote|Hatnote}}
Template:Elc
Template:Elc
Formats wikilink, with optional piped link text and blended suffix
{{ml|Example|hello}} Template:Ml Counterpart to Template loop detected: Template:Tl for linking to Lua modules
{{mlx|Example|hello}} Template:Mlx Counterpart to Template loop detected: Template:Tl for linking to Lua modules
{{para|title|<var>book title</var>}} Template:Para Formats template parameters for display, with or without values
{{sclx|LASTING}} Template:Sclx Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag.
{{tag|ref}}
{{xtag|templatedata}}
Template:Tag
Template:Xtag
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing
{{dtl|Ping project}} Template:Dtl Wikidata counterpart to Template loop detected: Template:Tl
{{pf|if}}
{{pf|if|{{{1}}}|true|false}}
Template:Pf
Template:Pf
Parser function equivalent to Template loop detected: Template:Tl
{{magic word|uc:}} Template:Magic word Magic word links

With utility links

Templates producing utility links for a given template (Hatnote used here as example)
Code example Effect
{{lt|Hatnote}} Template:Lt
{{lts|Hatnote}} Template:Lts
{{t links|Hatnote}} Template:T links
{{tfd links|Hatnote}} Template:Tfd links
{{tetl|Hatnote}} Template:Tetl
{{tsetl|Hatnote}} Template:Tsetl
{{ti|Hatnote}} Template:Ti
{{tic|Hatnote}} Template:Tic
{{tim|Hatnote}} Template:Tim
{{tiw|Hatnote}} Template loop detected: Template:Tiw
{{tlt|Hatnote}} Template:Tlt
{{ttl|Hatnote}} Template:Ttl
{{twlh|Hatnote}} Template:Twlh

Template:Sandbox other to produce a [t]emplate [l]ink with single [p]arameter.

Description

The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.

For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.

Usage

Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"): {{distinguish|Foo}}Template loop detected: Template:Distinguish


This hatnote can be used to distinguish the topic from multiple other topics: {{distinguish|Foo|Bar}}Template loop detected: Template:Distinguish {{distinguish|Foo|Bar|Gaz}}Template loop detected: Template:Distinguish


It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped: {{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}Template loop detected: Template:Distinguish

Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].

It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.

When to use

This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:

Coma
Template loop detected: Template:Distinguish

Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.

However, {{distinguish}} is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:

Template:Cross Reversi
Template loop detected: Template:Distinguish

In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.

In this case you should use {{about}} instead of {{distinguish}}. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.

Template:Tick Reversi
Template:About

{{Distinguish}} should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools; click here to see a monthly parameter usage report for this template.

TemplateData for Yesno

Template:Template other

A hatnote used when there is an ambiguity in an article's title.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Name of article1

Name of article that you want to link to

Page namesuggested
Optional additional article to link (2)2

Optional additional article to link

Page nameoptional
Optional additional article to link (3)3

Optional additional article to link

Page nameoptional
Optional additional article to link (4)4

Optional additional article to link

Page nameoptional
Custom texttext

Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]."

Stringoptional
Self referenceselfref

If set, marks note as being a self reference, to not be shown when content is reused

Booleanoptional

Redirects

See also

Template:Hatnote templates

Template:Sandbox other This template displays a message that the current page is a documentation subpage.

Usage

{{Documentation subpage}}
or
{{Documentation subpage|[[Template:Var]]}}



Template:Example needed

Userbox documentation

To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:

{{Userbox documentation subpage}}
or
{{Userbox documentation subpage|[[Template:Var]]}}

Text customization

The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1: Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end

Other parameters

Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)

Display

This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:

  • On a /doc page, it displays a box explaining template documentation and links to the template page.
  • On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains Template loop detected: Template:Template link) will automatically note that the documentation is transcluded from a subpage.

Functions

In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".

See also

Template:Sandbox other

Template:Big

Usage

Template:Dated maintenance category

Template:Confusing

See also

Template:Navbar

General-purpose formatting

Comparison of template-linking templates according to the styles of generated text and link produced
Text style ↓ {{tlg}} optionsTemplate:NoteTag
to achieve text style
Link style
Linked Unlinked Linked with subst Unlinked with subst Linked including braces Linked with alternative text
{{tlg}} optionsTemplate:NoteTag
to achieve link style
Template:N/a Template:N/a Template:Code Template:Code nolink=yes|subst=yes Template:Code Template:Code
Template:Code
normal Template:N/a Template:NowrapTemplate:NoteTag
Template loop detected: Template:Tl
Template:TlpTemplate:NoteTag
Template:TluTemplate:NoteTag
{{tlf}}Template:NoteTag
<template link>
Template:Tls
Template:TlsuTemplate:NoteTag
{{tlsf}}Template:NoteTag
<template link>
Template:Tn Template:Tla
code Template:Code Template:Tl2
{{tlx}}
Template:TlxuTemplate:NoteTag
{{tlc}}Template:NoteTag
<template link>
Template:Tnull<template link>
Template:Tlxs Template:TlscTemplate:NoteTag
<template link>
colspan="2" rowspan="3" Template:N/a
monospace Template:CodeTemplate:NoteTag colspan="2" rowspan="2" Template:N/a Template:TltssTemplate:NoteTag rowspan="2" Template:N/a
kbd Template:CodeTemplate:NoteTag
bold Template:Code Template:Tlb colspan="5" rowspan="3" Template:N/a
bold+code bold=yes|code=yes Template:Tlxb
italic+code italic=yes|code=yes Template:Tlxi

Template:NoteFoot Template:Clear

Other formatting templates

Templates producing specialised formatting effects for given templates, modules or parameters
Code example Effect Notes
{{tl2|Hatnote|lang=fr}} Template:Tl2 Supports linking to sister projects (e.g., fr:Hatnote)
{{tlu|User:Ahunt/SSHFS}} Template:Tlu Supports linking to any namespace
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}} Template:Demo Shows code and example
{{xpd|Hatnote|Some hatnote text}} Template:Xpd Shows code, example and a link to expand the template code
{{tln|Hatnote}} Template:Tln Produces a normal link to the template
{{elc|Template:Hatnote}}
{{elc|Template:Hatnote|Hatnote}}
Template:Elc
Template:Elc
Formats wikilink, with optional piped link text and blended suffix
{{ml|Example|hello}} Template:Ml Counterpart to Template loop detected: Template:Tl for linking to Lua modules
{{mlx|Example|hello}} Template:Mlx Counterpart to Template loop detected: Template:Tl for linking to Lua modules
{{para|title|<var>book title</var>}} Template:Para Formats template parameters for display, with or without values
{{sclx|LASTING}} Template:Sclx Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag.
{{tag|ref}}
{{xtag|templatedata}}
Template:Tag
Template:Xtag
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing
{{dtl|Ping project}} Template:Dtl Wikidata counterpart to Template loop detected: Template:Tl
{{pf|if}}
{{pf|if|{{{1}}}|true|false}}
Template:Pf
Template:Pf
Parser function equivalent to Template loop detected: Template:Tl
{{magic word|uc:}} Template:Magic word Magic word links

With utility links

Templates producing utility links for a given template (Hatnote used here as example)
Code example Effect
{{lt|Hatnote}} Template:Lt
{{lts|Hatnote}} Template:Lts
{{t links|Hatnote}} Template:T links
{{tfd links|Hatnote}} Template:Tfd links
{{tetl|Hatnote}} Template:Tetl
{{tsetl|Hatnote}} Template:Tsetl
{{ti|Hatnote}} Template:Ti
{{tic|Hatnote}} Template:Tic
{{tim|Hatnote}} Template:Tim
{{tiw|Hatnote}} Template loop detected: Template:Tiw
{{tlt|Hatnote}} Template:Tlt
{{ttl|Hatnote}} Template:Ttl
{{twlh|Hatnote}} Template:Twlh

Template:Sandbox other to produce a [t]emplate [l]ink with e[x]tended number of parameters.

Description

The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.

For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.

Usage

Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"): {{distinguish|Foo}}Template loop detected: Template:Distinguish


This hatnote can be used to distinguish the topic from multiple other topics: {{distinguish|Foo|Bar}}Template loop detected: Template:Distinguish {{distinguish|Foo|Bar|Gaz}}Template loop detected: Template:Distinguish


It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped: {{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}Template loop detected: Template:Distinguish

Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].

It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.

When to use

This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:

Coma
Template loop detected: Template:Distinguish

Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.

However, {{distinguish}} is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:

Template:Cross Reversi
Template loop detected: Template:Distinguish

In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.

In this case you should use {{about}} instead of {{distinguish}}. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.

Template:Tick Reversi
Template:About

{{Distinguish}} should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools; click here to see a monthly parameter usage report for this template.

TemplateData for Yesno

Template:Template other

A hatnote used when there is an ambiguity in an article's title.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Name of article1

Name of article that you want to link to

Page namesuggested
Optional additional article to link (2)2

Optional additional article to link

Page nameoptional
Optional additional article to link (3)3

Optional additional article to link

Page nameoptional
Optional additional article to link (4)4

Optional additional article to link

Page nameoptional
Custom texttext

Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]."

Stringoptional
Self referenceselfref

If set, marks note as being a self reference, to not be shown when content is reused

Booleanoptional

Redirects

See also

Template:Hatnote templates

Template:Sandbox other This template displays a message that the current page is a documentation subpage.

Usage

{{Documentation subpage}}
or
{{Documentation subpage|[[Template:Var]]}}



Template:Example needed

Userbox documentation

To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:

{{Userbox documentation subpage}}
or
{{Userbox documentation subpage|[[Template:Var]]}}

Text customization

The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1: Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end

Other parameters

Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)

Display

This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:

  • On a /doc page, it displays a box explaining template documentation and links to the template page.
  • On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains Template loop detected: Template:Template link) will automatically note that the documentation is transcluded from a subpage.

Functions

In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".

See also

Template:Sandbox other

Template:Big

Usage

Template:Dated maintenance category

Template:Confusing

See also

Template:Navbar

General-purpose formatting

Comparison of template-linking templates according to the styles of generated text and link produced
Text style ↓ {{tlg}} optionsTemplate:NoteTag
to achieve text style
Link style
Linked Unlinked Linked with subst Unlinked with subst Linked including braces Linked with alternative text
{{tlg}} optionsTemplate:NoteTag
to achieve link style
Template:N/a Template:N/a Template:Code Template:Code nolink=yes|subst=yes Template:Code Template:Code
Template:Code
normal Template:N/a Template:NowrapTemplate:NoteTag
Template loop detected: Template:Tl
Template:TlpTemplate:NoteTag
Template:TluTemplate:NoteTag
{{tlf}}Template:NoteTag
<template link>
Template:Tls
Template:TlsuTemplate:NoteTag
{{tlsf}}Template:NoteTag
<template link>
Template:Tn Template:Tla
code Template:Code Template:Tl2
{{tlx}}
Template:TlxuTemplate:NoteTag
{{tlc}}Template:NoteTag
<template link>
Template:Tnull<template link>
Template:Tlxs Template:TlscTemplate:NoteTag
<template link>
colspan="2" rowspan="3" Template:N/a
monospace Template:CodeTemplate:NoteTag colspan="2" rowspan="2" Template:N/a Template:TltssTemplate:NoteTag rowspan="2" Template:N/a
kbd Template:CodeTemplate:NoteTag
bold Template:Code Template:Tlb colspan="5" rowspan="3" Template:N/a
bold+code bold=yes|code=yes Template:Tlxb
italic+code italic=yes|code=yes Template:Tlxi

Template:NoteFoot Template:Clear

Other formatting templates

Templates producing specialised formatting effects for given templates, modules or parameters
Code example Effect Notes
{{tl2|Hatnote|lang=fr}} Template:Tl2 Supports linking to sister projects (e.g., fr:Hatnote)
{{tlu|User:Ahunt/SSHFS}} Template:Tlu Supports linking to any namespace
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}} Template:Demo Shows code and example
{{xpd|Hatnote|Some hatnote text}} Template:Xpd Shows code, example and a link to expand the template code
{{tln|Hatnote}} Template:Tln Produces a normal link to the template
{{elc|Template:Hatnote}}
{{elc|Template:Hatnote|Hatnote}}
Template:Elc
Template:Elc
Formats wikilink, with optional piped link text and blended suffix
{{ml|Example|hello}} Template:Ml Counterpart to Template loop detected: Template:Tl for linking to Lua modules
{{mlx|Example|hello}} Template:Mlx Counterpart to Template loop detected: Template:Tl for linking to Lua modules
{{para|title|<var>book title</var>}} Template:Para Formats template parameters for display, with or without values
{{sclx|LASTING}} Template:Sclx Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag.
{{tag|ref}}
{{xtag|templatedata}}
Template:Tag
Template:Xtag
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing
{{dtl|Ping project}} Template:Dtl Wikidata counterpart to Template loop detected: Template:Tl
{{pf|if}}
{{pf|if|{{{1}}}|true|false}}
Template:Pf
Template:Pf
Parser function equivalent to Template loop detected: Template:Tl
{{magic word|uc:}} Template:Magic word Magic word links

With utility links

Templates producing utility links for a given template (Hatnote used here as example)
Code example Effect
{{lt|Hatnote}} Template:Lt
{{lts|Hatnote}} Template:Lts
{{t links|Hatnote}} Template:T links
{{tfd links|Hatnote}} Template:Tfd links
{{tetl|Hatnote}} Template:Tetl
{{tsetl|Hatnote}} Template:Tsetl
{{ti|Hatnote}} Template:Ti
{{tic|Hatnote}} Template:Tic
{{tim|Hatnote}} Template:Tim
{{tiw|Hatnote}} Template loop detected: Template:Tiw
{{tlt|Hatnote}} Template:Tlt
{{ttl|Hatnote}} Template:Ttl
{{twlh|Hatnote}} Template:Twlh

Template:Sandbox other to produce a [t]emplate [l]ink that's [s]ubst:ituted, with a single [p]arameter.

Description

The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.

For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.

Usage

Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"): {{distinguish|Foo}}Template loop detected: Template:Distinguish


This hatnote can be used to distinguish the topic from multiple other topics: {{distinguish|Foo|Bar}}Template loop detected: Template:Distinguish {{distinguish|Foo|Bar|Gaz}}Template loop detected: Template:Distinguish


It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped: {{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}Template loop detected: Template:Distinguish

Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].

It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.

When to use

This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:

Coma
Template loop detected: Template:Distinguish

Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.

However, {{distinguish}} is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:

Template:Cross Reversi
Template loop detected: Template:Distinguish

In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.

In this case you should use {{about}} instead of {{distinguish}}. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.

Template:Tick Reversi
Template:About

{{Distinguish}} should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools; click here to see a monthly parameter usage report for this template.

TemplateData for Yesno

Template:Template other

A hatnote used when there is an ambiguity in an article's title.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Name of article1

Name of article that you want to link to

Page namesuggested
Optional additional article to link (2)2

Optional additional article to link

Page nameoptional
Optional additional article to link (3)3

Optional additional article to link

Page nameoptional
Optional additional article to link (4)4

Optional additional article to link

Page nameoptional
Custom texttext

Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]."

Stringoptional
Self referenceselfref

If set, marks note as being a self reference, to not be shown when content is reused

Booleanoptional

Redirects

See also

Template:Hatnote templates

Template:Sandbox other This template displays a message that the current page is a documentation subpage.

Usage

{{Documentation subpage}}
or
{{Documentation subpage|[[Template:Var]]}}



Template:Example needed

Userbox documentation

To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:

{{Userbox documentation subpage}}
or
{{Userbox documentation subpage|[[Template:Var]]}}

Text customization

The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1: Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end

Other parameters

Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)

Display

This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:

  • On a /doc page, it displays a box explaining template documentation and links to the template page.
  • On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains Template loop detected: Template:Template link) will automatically note that the documentation is transcluded from a subpage.

Functions

In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".

See also

Template:Sandbox other

Template:Big

Usage

Template:Dated maintenance category

Template:Confusing

See also

Template:Navbar

General-purpose formatting

Comparison of template-linking templates according to the styles of generated text and link produced
Text style ↓ {{tlg}} optionsTemplate:NoteTag
to achieve text style
Link style
Linked Unlinked Linked with subst Unlinked with subst Linked including braces Linked with alternative text
{{tlg}} optionsTemplate:NoteTag
to achieve link style
Template:N/a Template:N/a Template:Code Template:Code nolink=yes|subst=yes Template:Code Template:Code
Template:Code
normal Template:N/a Template:NowrapTemplate:NoteTag
Template loop detected: Template:Tl
Template:TlpTemplate:NoteTag
Template:TluTemplate:NoteTag
{{tlf}}Template:NoteTag
<template link>
Template:Tls
Template:TlsuTemplate:NoteTag
{{tlsf}}Template:NoteTag
<template link>
Template:Tn Template:Tla
code Template:Code Template:Tl2
{{tlx}}
Template:TlxuTemplate:NoteTag
{{tlc}}Template:NoteTag
<template link>
Template:Tnull<template link>
Template:Tlxs Template:TlscTemplate:NoteTag
<template link>
colspan="2" rowspan="3" Template:N/a
monospace Template:CodeTemplate:NoteTag colspan="2" rowspan="2" Template:N/a Template:TltssTemplate:NoteTag rowspan="2" Template:N/a
kbd Template:CodeTemplate:NoteTag
bold Template:Code Template:Tlb colspan="5" rowspan="3" Template:N/a
bold+code bold=yes|code=yes Template:Tlxb
italic+code italic=yes|code=yes Template:Tlxi

Template:NoteFoot Template:Clear

Other formatting templates

Templates producing specialised formatting effects for given templates, modules or parameters
Code example Effect Notes
{{tl2|Hatnote|lang=fr}} Template:Tl2 Supports linking to sister projects (e.g., fr:Hatnote)
{{tlu|User:Ahunt/SSHFS}} Template:Tlu Supports linking to any namespace
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}} Template:Demo Shows code and example
{{xpd|Hatnote|Some hatnote text}} Template:Xpd Shows code, example and a link to expand the template code
{{tln|Hatnote}} Template:Tln Produces a normal link to the template
{{elc|Template:Hatnote}}
{{elc|Template:Hatnote|Hatnote}}
Template:Elc
Template:Elc
Formats wikilink, with optional piped link text and blended suffix
{{ml|Example|hello}} Template:Ml Counterpart to Template loop detected: Template:Tl for linking to Lua modules
{{mlx|Example|hello}} Template:Mlx Counterpart to Template loop detected: Template:Tl for linking to Lua modules
{{para|title|<var>book title</var>}} Template:Para Formats template parameters for display, with or without values
{{sclx|LASTING}} Template:Sclx Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag.
{{tag|ref}}
{{xtag|templatedata}}
Template:Tag
Template:Xtag
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing
{{dtl|Ping project}} Template:Dtl Wikidata counterpart to Template loop detected: Template:Tl
{{pf|if}}
{{pf|if|{{{1}}}|true|false}}
Template:Pf
Template:Pf
Parser function equivalent to Template loop detected: Template:Tl
{{magic word|uc:}} Template:Magic word Magic word links

With utility links

Templates producing utility links for a given template (Hatnote used here as example)
Code example Effect
{{lt|Hatnote}} Template:Lt
{{lts|Hatnote}} Template:Lts
{{t links|Hatnote}} Template:T links
{{tfd links|Hatnote}} Template:Tfd links
{{tetl|Hatnote}} Template:Tetl
{{tsetl|Hatnote}} Template:Tsetl
{{ti|Hatnote}} Template:Ti
{{tic|Hatnote}} Template:Tic
{{tim|Hatnote}} Template:Tim
{{tiw|Hatnote}} Template loop detected: Template:Tiw
{{tlt|Hatnote}} Template:Tlt
{{ttl|Hatnote}} Template:Ttl
{{twlh|Hatnote}} Template:Twlh

Template:Sandbox other

Description

The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.

For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.

Usage

Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"): {{distinguish|Foo}}Template loop detected: Template:Distinguish


This hatnote can be used to distinguish the topic from multiple other topics: {{distinguish|Foo|Bar}}Template loop detected: Template:Distinguish {{distinguish|Foo|Bar|Gaz}}Template loop detected: Template:Distinguish


It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped: {{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}Template loop detected: Template:Distinguish

Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].

It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.

When to use

This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:

Coma
Template loop detected: Template:Distinguish

Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.

However, {{distinguish}} is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:

Template:Cross Reversi
Template loop detected: Template:Distinguish

In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.

In this case you should use {{about}} instead of {{distinguish}}. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.

Template:Tick Reversi
Template:About

{{Distinguish}} should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools; click here to see a monthly parameter usage report for this template.

TemplateData for Yesno

Template:Template other

A hatnote used when there is an ambiguity in an article's title.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Name of article1

Name of article that you want to link to

Page namesuggested
Optional additional article to link (2)2

Optional additional article to link

Page nameoptional
Optional additional article to link (3)3

Optional additional article to link

Page nameoptional
Optional additional article to link (4)4

Optional additional article to link

Page nameoptional
Custom texttext

Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]."

Stringoptional
Self referenceselfref

If set, marks note as being a self reference, to not be shown when content is reused

Booleanoptional

Redirects

See also

Template:Hatnote templates

Template:Sandbox other This template displays a message that the current page is a documentation subpage.

Usage

{{Documentation subpage}}
or
{{Documentation subpage|[[Template:Var]]}}



Template:Example needed

Userbox documentation

To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:

{{Userbox documentation subpage}}
or
{{Userbox documentation subpage|[[Template:Var]]}}

Text customization

The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1: Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end

Other parameters

Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)

Display

This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:

  • On a /doc page, it displays a box explaining template documentation and links to the template page.
  • On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains Template loop detected: Template:Template link) will automatically note that the documentation is transcluded from a subpage.

Functions

In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".

See also

Template:Sandbox other

Template:Big

Usage

Template:Dated maintenance category

Template:Confusing

See also

Template:Navbar

General-purpose formatting

Comparison of template-linking templates according to the styles of generated text and link produced
Text style ↓ {{tlg}} optionsTemplate:NoteTag
to achieve text style
Link style
Linked Unlinked Linked with subst Unlinked with subst Linked including braces Linked with alternative text
{{tlg}} optionsTemplate:NoteTag
to achieve link style
Template:N/a Template:N/a Template:Code Template:Code nolink=yes|subst=yes Template:Code Template:Code
Template:Code
normal Template:N/a Template:NowrapTemplate:NoteTag
Template loop detected: Template:Tl
Template:TlpTemplate:NoteTag
Template:TluTemplate:NoteTag
{{tlf}}Template:NoteTag
<template link>
Template:Tls
Template:TlsuTemplate:NoteTag
{{tlsf}}Template:NoteTag
<template link>
Template:Tn Template:Tla
code Template:Code Template:Tl2
{{tlx}}
Template:TlxuTemplate:NoteTag
{{tlc}}Template:NoteTag
<template link>
Template:Tnull<template link>
Template:Tlxs Template:TlscTemplate:NoteTag
<template link>
colspan="2" rowspan="3" Template:N/a
monospace Template:CodeTemplate:NoteTag colspan="2" rowspan="2" Template:N/a Template:TltssTemplate:NoteTag rowspan="2" Template:N/a
kbd Template:CodeTemplate:NoteTag
bold Template:Code Template:Tlb colspan="5" rowspan="3" Template:N/a
bold+code bold=yes|code=yes Template:Tlxb
italic+code italic=yes|code=yes Template:Tlxi

Template:NoteFoot Template:Clear

Other formatting templates

Templates producing specialised formatting effects for given templates, modules or parameters
Code example Effect Notes
{{tl2|Hatnote|lang=fr}} Template:Tl2 Supports linking to sister projects (e.g., fr:Hatnote)
{{tlu|User:Ahunt/SSHFS}} Template:Tlu Supports linking to any namespace
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}} Template:Demo Shows code and example
{{xpd|Hatnote|Some hatnote text}} Template:Xpd Shows code, example and a link to expand the template code
{{tln|Hatnote}} Template:Tln Produces a normal link to the template
{{elc|Template:Hatnote}}
{{elc|Template:Hatnote|Hatnote}}
Template:Elc
Template:Elc
Formats wikilink, with optional piped link text and blended suffix
{{ml|Example|hello}} Template:Ml Counterpart to Template loop detected: Template:Tl for linking to Lua modules
{{mlx|Example|hello}} Template:Mlx Counterpart to Template loop detected: Template:Tl for linking to Lua modules
{{para|title|<var>book title</var>}} Template:Para Formats template parameters for display, with or without values
{{sclx|LASTING}} Template:Sclx Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag.
{{tag|ref}}
{{xtag|templatedata}}
Template:Tag
Template:Xtag
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing
{{dtl|Ping project}} Template:Dtl Wikidata counterpart to Template loop detected: Template:Tl
{{pf|if}}
{{pf|if|{{{1}}}|true|false}}
Template:Pf
Template:Pf
Parser function equivalent to Template loop detected: Template:Tl
{{magic word|uc:}} Template:Magic word Magic word links

With utility links

Templates producing utility links for a given template (Hatnote used here as example)
Code example Effect
{{lt|Hatnote}} Template:Lt
{{lts|Hatnote}} Template:Lts
{{t links|Hatnote}} Template:T links
{{tfd links|Hatnote}} Template:Tfd links
{{tetl|Hatnote}} Template:Tetl
{{tsetl|Hatnote}} Template:Tsetl
{{ti|Hatnote}} Template:Ti
{{tic|Hatnote}} Template:Tic
{{tim|Hatnote}} Template:Tim
{{tiw|Hatnote}} Template loop detected: Template:Tiw
{{tlt|Hatnote}} Template:Tlt
{{ttl|Hatnote}} Template:Ttl
{{twlh|Hatnote}} Template:Twlh

Template:Sandbox other, tl or tlp in any namespace.

Description

The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.

For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.

Usage

Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"): {{distinguish|Foo}}Template loop detected: Template:Distinguish


This hatnote can be used to distinguish the topic from multiple other topics: {{distinguish|Foo|Bar}}Template loop detected: Template:Distinguish {{distinguish|Foo|Bar|Gaz}}Template loop detected: Template:Distinguish


It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped: {{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}Template loop detected: Template:Distinguish

Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].

It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.

When to use

This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:

Coma
Template loop detected: Template:Distinguish

Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.

However, {{distinguish}} is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:

Template:Cross Reversi
Template loop detected: Template:Distinguish

In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.

In this case you should use {{about}} instead of {{distinguish}}. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.

Template:Tick Reversi
Template:About

{{Distinguish}} should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools; click here to see a monthly parameter usage report for this template.

TemplateData for Yesno

Template:Template other

A hatnote used when there is an ambiguity in an article's title.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Name of article1

Name of article that you want to link to

Page namesuggested
Optional additional article to link (2)2

Optional additional article to link

Page nameoptional
Optional additional article to link (3)3

Optional additional article to link

Page nameoptional
Optional additional article to link (4)4

Optional additional article to link

Page nameoptional
Custom texttext

Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]."

Stringoptional
Self referenceselfref

If set, marks note as being a self reference, to not be shown when content is reused

Booleanoptional

Redirects

See also

Template:Hatnote templates

Template:Sandbox other This template displays a message that the current page is a documentation subpage.

Usage

{{Documentation subpage}}
or
{{Documentation subpage|[[Template:Var]]}}



Template:Example needed

Userbox documentation

To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:

{{Userbox documentation subpage}}
or
{{Userbox documentation subpage|[[Template:Var]]}}

Text customization

The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1: Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end

Other parameters

Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)

Display

This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:

  • On a /doc page, it displays a box explaining template documentation and links to the template page.
  • On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains Template loop detected: Template:Template link) will automatically note that the documentation is transcluded from a subpage.

Functions

In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".

See also

Template:Sandbox other

Template:Big

Usage

Template:Dated maintenance category

Template:Confusing

See also

Template:Navbar

General-purpose formatting

Comparison of template-linking templates according to the styles of generated text and link produced
Text style ↓ {{tlg}} optionsTemplate:NoteTag
to achieve text style
Link style
Linked Unlinked Linked with subst Unlinked with subst Linked including braces Linked with alternative text
{{tlg}} optionsTemplate:NoteTag
to achieve link style
Template:N/a Template:N/a Template:Code Template:Code nolink=yes|subst=yes Template:Code Template:Code
Template:Code
normal Template:N/a Template:NowrapTemplate:NoteTag
Template loop detected: Template:Tl
Template:TlpTemplate:NoteTag
Template:TluTemplate:NoteTag
{{tlf}}Template:NoteTag
<template link>
Template:Tls
Template:TlsuTemplate:NoteTag
{{tlsf}}Template:NoteTag
<template link>
Template:Tn Template:Tla
code Template:Code Template:Tl2
{{tlx}}
Template:TlxuTemplate:NoteTag
{{tlc}}Template:NoteTag
<template link>
Template:Tnull<template link>
Template:Tlxs Template:TlscTemplate:NoteTag
<template link>
colspan="2" rowspan="3" Template:N/a
monospace Template:CodeTemplate:NoteTag colspan="2" rowspan="2" Template:N/a Template:TltssTemplate:NoteTag rowspan="2" Template:N/a
kbd Template:CodeTemplate:NoteTag
bold Template:Code Template:Tlb colspan="5" rowspan="3" Template:N/a
bold+code bold=yes|code=yes Template:Tlxb
italic+code italic=yes|code=yes Template:Tlxi

Template:NoteFoot Template:Clear

Other formatting templates

Templates producing specialised formatting effects for given templates, modules or parameters
Code example Effect Notes
{{tl2|Hatnote|lang=fr}} Template:Tl2 Supports linking to sister projects (e.g., fr:Hatnote)
{{tlu|User:Ahunt/SSHFS}} Template:Tlu Supports linking to any namespace
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}} Template:Demo Shows code and example
{{xpd|Hatnote|Some hatnote text}} Template:Xpd Shows code, example and a link to expand the template code
{{tln|Hatnote}} Template:Tln Produces a normal link to the template
{{elc|Template:Hatnote}}
{{elc|Template:Hatnote|Hatnote}}
Template:Elc
Template:Elc
Formats wikilink, with optional piped link text and blended suffix
{{ml|Example|hello}} Template:Ml Counterpart to Template loop detected: Template:Tl for linking to Lua modules
{{mlx|Example|hello}} Template:Mlx Counterpart to Template loop detected: Template:Tl for linking to Lua modules
{{para|title|<var>book title</var>}} Template:Para Formats template parameters for display, with or without values
{{sclx|LASTING}} Template:Sclx Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag.
{{tag|ref}}
{{xtag|templatedata}}
Template:Tag
Template:Xtag
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing
{{dtl|Ping project}} Template:Dtl Wikidata counterpart to Template loop detected: Template:Tl
{{pf|if}}
{{pf|if|{{{1}}}|true|false}}
Template:Pf
Template:Pf
Parser function equivalent to Template loop detected: Template:Tl
{{magic word|uc:}} Template:Magic word Magic word links

With utility links

Templates producing utility links for a given template (Hatnote used here as example)
Code example Effect
{{lt|Hatnote}} Template:Lt
{{lts|Hatnote}} Template:Lts
{{t links|Hatnote}} Template:T links
{{tfd links|Hatnote}} Template:Tfd links
{{tetl|Hatnote}} Template:Tetl
{{tsetl|Hatnote}} Template:Tsetl
{{ti|Hatnote}} Template:Ti
{{tic|Hatnote}} Template:Tic
{{tim|Hatnote}} Template:Tim
{{tiw|Hatnote}} Template loop detected: Template:Tiw
{{tlt|Hatnote}} Template:Tlt
{{ttl|Hatnote}} Template:Ttl
{{twlh|Hatnote}} Template:Twlh

Template:Sandbox other to e[xp]an[d] (i.e. demonstrate) a template in situ.

Template:Navbar

General-purpose formatting

Comparison of template-linking templates according to the styles of generated text and link produced
Text style ↓ {{tlg}} optionsTemplate:NoteTag
to achieve text style
Link style
Linked Unlinked Linked with subst Unlinked with subst Linked including braces Linked with alternative text
{{tlg}} optionsTemplate:NoteTag
to achieve link style
Template:N/a Template:N/a Template:Code Template:Code nolink=yes|subst=yes Template:Code Template:Code
Template:Code
normal Template:N/a Template:NowrapTemplate:NoteTag
Template loop detected: Template:Tl
Template:TlpTemplate:NoteTag
Template:TluTemplate:NoteTag
{{tlf}}Template:NoteTag
<template link>
Template:Tls
Template:TlsuTemplate:NoteTag
{{tlsf}}Template:NoteTag
<template link>
Template:Tn Template:Tla
code Template:Code Template:Tl2
{{tlx}}
Template:TlxuTemplate:NoteTag
{{tlc}}Template:NoteTag
<template link>
Template:Tnull<template link>
Template:Tlxs Template:TlscTemplate:NoteTag
<template link>
colspan="2" rowspan="3" Template:N/a
monospace Template:CodeTemplate:NoteTag colspan="2" rowspan="2" Template:N/a Template:TltssTemplate:NoteTag rowspan="2" Template:N/a
kbd Template:CodeTemplate:NoteTag
bold Template:Code Template:Tlb colspan="5" rowspan="3" Template:N/a
bold+code bold=yes|code=yes Template:Tlxb
italic+code italic=yes|code=yes Template:Tlxi

Template:NoteFoot Template:Clear

Other formatting templates

Templates producing specialised formatting effects for given templates, modules or parameters
Code example Effect Notes
{{tl2|Hatnote|lang=fr}} Template:Tl2 Supports linking to sister projects (e.g., fr:Hatnote)
{{tlu|User:Ahunt/SSHFS}} Template:Tlu Supports linking to any namespace
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}} Template:Demo Shows code and example
{{xpd|Hatnote|Some hatnote text}} Template:Xpd Shows code, example and a link to expand the template code
{{tln|Hatnote}} Template:Tln Produces a normal link to the template
{{elc|Template:Hatnote}}
{{elc|Template:Hatnote|Hatnote}}
Template:Elc
Template:Elc
Formats wikilink, with optional piped link text and blended suffix
{{ml|Example|hello}} Template:Ml Counterpart to Template loop detected: Template:Tl for linking to Lua modules
{{mlx|Example|hello}} Template:Mlx Counterpart to Template loop detected: Template:Tl for linking to Lua modules
{{para|title|<var>book title</var>}} Template:Para Formats template parameters for display, with or without values
{{sclx|LASTING}} Template:Sclx Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag.
{{tag|ref}}
{{xtag|templatedata}}
Template:Tag
Template:Xtag
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing
{{dtl|Ping project}} Template:Dtl Wikidata counterpart to Template loop detected: Template:Tl
{{pf|if}}
{{pf|if|{{{1}}}|true|false}}
Template:Pf
Template:Pf
Parser function equivalent to Template loop detected: Template:Tl
{{magic word|uc:}} Template:Magic word Magic word links

With utility links

Templates producing utility links for a given template (Hatnote used here as example)
Code example Effect
{{lt|Hatnote}} Template:Lt
{{lts|Hatnote}} Template:Lts
{{t links|Hatnote}} Template:T links
{{tfd links|Hatnote}} Template:Tfd links
{{tetl|Hatnote}} Template:Tetl
{{tsetl|Hatnote}} Template:Tsetl
{{ti|Hatnote}} Template:Ti
{{tic|Hatnote}} Template:Tic
{{tim|Hatnote}} Template:Tim
{{tiw|Hatnote}} Template loop detected: Template:Documentation subpage

Description

The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.

For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.

Usage

Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"): {{distinguish|Foo}}Template loop detected: Template:Distinguish


This hatnote can be used to distinguish the topic from multiple other topics: {{distinguish|Foo|Bar}}Template loop detected: Template:Distinguish {{distinguish|Foo|Bar|Gaz}}Template loop detected: Template:Distinguish


It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped: {{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}Template loop detected: Template:Distinguish

Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].

It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.

When to use

This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:

Coma
Template loop detected: Template:Distinguish

Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.

However, {{distinguish}} is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:

Template:Cross Reversi
Template loop detected: Template:Distinguish

In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.

In this case you should use {{about}} instead of {{distinguish}}. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.

Template:Tick Reversi
Template:About

{{Distinguish}} should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools; click here to see a monthly parameter usage report for this template.

TemplateData for Yesno

Template:Template other

A hatnote used when there is an ambiguity in an article's title.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Name of article1

Name of article that you want to link to

Page namesuggested
Optional additional article to link (2)2

Optional additional article to link

Page nameoptional
Optional additional article to link (3)3

Optional additional article to link

Page nameoptional
Optional additional article to link (4)4

Optional additional article to link

Page nameoptional
Custom texttext

Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]."

Stringoptional
Self referenceselfref

If set, marks note as being a self reference, to not be shown when content is reused

Booleanoptional

Redirects

See also

Template:Hatnote templates

Template:Sandbox other This template displays a message that the current page is a documentation subpage.

Usage

{{Documentation subpage}}
or
{{Documentation subpage|[[Template:Var]]}}



Template:Example needed

Userbox documentation

To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:

{{Userbox documentation subpage}}
or
{{Userbox documentation subpage|[[Template:Var]]}}

Text customization

The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1: Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text2='''''text2 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end Template:Hidden begin {{Documentation subpage |text1='''''text1 appears here'''''}} Template loop detected: Template:Documentation subpage Template:Hidden end

Other parameters

Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)

Display

This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:

  • On a /doc page, it displays a box explaining template documentation and links to the template page.
  • On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains Template loop detected: Template:Template link) will automatically note that the documentation is transcluded from a subpage.

Functions

In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".

See also

Template:Sandbox other

Template:Big

Usage

Template:Dated maintenance category

Template:Confusing

See also

Template loop detected: Template:Template-linking templates

Template:Sandbox other

{{tlt|Hatnote}} Template:Tlt
{{ttl|Hatnote}} Template:Ttl
{{twlh|Hatnote}} Template:Twlh

Template:Sandbox other instead.

local yesno = require('Module:Yesno')

Some input values always return true, and some always return false. nil values always return nil.

-- These always return true:
yesno('yes')
yesno('y')
yesno('true')
yesno('t')
yesno('1')
yesno(1)
yesno(true)

-- These always return false:
yesno('no')
yesno('n')
yesno('false')
yesno('f')
yesno('0')
yesno(0)
yesno(false)

-- A nil value always returns nil:
yesno(nil)

String values are converted to lower case before they are matched:

-- These always return true:
yesno('Yes')
yesno('YES')
yesno('yEs')
yesno('Y')
yesno('tRuE')

-- These always return false:
yesno('No')
yesno('NO')
yesno('nO')
yesno('N')
yesno('fALsE')

You can specify a default value if yesno receives input other than that listed above. If you don't supply a default, the module will return nil for these inputs.

-- These return nil:
yesno('foo')
yesno({})
yesno(5)
yesno(function() return 'This is a function.' end)

-- These return true:
yesno('foo', true)
yesno({}, true)
yesno(5, true)
yesno(function() return 'This is a function.' end, true)

-- These return "bar":
yesno('foo', 'bar')
yesno({}, 'bar')
yesno(5, 'bar')
yesno(function() return 'This is a function.' end, 'bar')

Note that the empty string also functions this way:

yesno('')        -- Returns nil.
yesno('', true)  -- Returns true.
yesno('', 'bar') -- Returns "bar".

Although the empty string usually evaluates to false in wikitext, it evaluates to true in Lua. This module prefers the Lua behaviour over the wikitext behaviour. If treating the empty string as false is important for your module, you will need to convert empty strings to a value that evaluates to false before passing them to this module. In the case of arguments received from wikitext, this can be done by using Module:Arguments.


-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to the template {{yesno}}.

return function (val, default)
	-- If your wiki uses non-ascii characters for any of "yes", "no", etc., you
	-- should replace "val:lower()" with "mw.ustring.lower(val)" in the
	-- following line.
	val = type(val) == 'string' and val:lower() or val
	if val == nil then
		return nil
	elseif val == true 
		or val == 'yes'
		or val == 'y'
		or val == 'true'
		or val == 't'
		or val == 'on'
		or tonumber(val) == 1
	then
		return true
	elseif val == false
		or val == 'no'
		or val == 'n'
		or val == 'false'
		or val == 'f'
		or val == 'off'
		or tonumber(val) == 0
	then
		return false
	else
		return default
	end
end