Template:Hatnote/doc
{{#ifeq:doc |doc
|
{{#ifeq:show |show
| Script error: No such module "Message box".
}}{{#if: |
| {{#ifexist:Template:Hatnote
| [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
|
}}
}}
|
}}
Script error: No such module "Uses TemplateStyles". This template produces formatted text, following the guideline for a hatnote.
{{hatnote|Example hatnote text.}}
→
<templatestyles src="Hatnote/styles.css"/>
Broadly speaking, a hatnote should answer a readers' question (maybe preemptively): Am I on the right page?
Function
This template is primarily used to add a correctly formatted hatnote to a page. Often, but not always, this is a disambiguation link at the top of article pages. It places an HTML div-
/ div
block around the text entered as its only argument, which provides standardized formatting (contents are indented and italicized in most displays); it also isolates the contained code to make sure that it is interpreted correctly.
This template is also used as the "meta-template" for additional specialized disambiguation link templates.
The template does not automatically create links of any kind. Links and other desired formatting must be explicitly added, using normal Wikipedia markup.
Usage
{{hatnote|textTemplate:))
Parameters
This template accepts the following parameters:
1
- the hatnote text (required)
Example
{{hatnote|Example hatnote text}}
→ <templatestyles src="Hatnote/styles.css"/>Example hatnote text
Technical details
The HTML code produced by this template looks like this:
<syntaxhighlight lang="html" inline="1" style="border:0">Template:^(div role="note" class="hatnote"Template:)^</syntaxhighlight>hatnote text<syntaxhighlight lang="html" inline="1" style="border:0">Template:^(/divTemplate:)^</syntaxhighlight>
{{#switch:<translate></translate> |=
|no |n |false |0 = | = |¬ = |yes |y |true |1 = yes |#default = yes
}}|{{#ifexpr:{{#if:|{{#ifeq:Template:Hatnote/doc|{{#switch:
|#default = | = {{#ifeq: | | Template:{{{docpage}}} | }}
}}|0|1}}|not{{#ifexpr: ( {{#ifeq:doc|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:hatnote/doc|-1|-2}}|doc|1|0}} and {{#if:{{#translation:}}|1|0}} ) )|1|0}}}}|<templatestyles src="Module:Navbar/styles.css"/>
|#default = Hatnote/doc | = {{#ifeq: | | Template:Hatnote/doc | Hatnote/doc }}
}}|<span style="" title="<translate nowrap> View this template</translate>">{{#if:|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="" title="<translate nowrap> Discuss this template</translate>">{{#if:|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch:
|#default = Hatnote/doc | = {{#ifeq: | | Template:Hatnote/doc | Hatnote/doc }}
}}|action=edit}} <span style="" title="<translate nowrap> Edit this template</translate>">{{#if:|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:1|]}}}}}} {{#if:1||<translate> This is the [[<tvar name=1>Special:MyLanguage/Help:TemplateData</tvar>|TemplateData]] documentation for this template used by [[<tvar name=2>Special:MyLanguage/VisualEditor</tvar>|VisualEditor]] and other tools.</translate>}}
Hatnote
{{#ifeq:doc|sandbox||{{#if:{{#ifexpr: (
{{#ifeq:doc|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:hatnote/doc|-1|-2}}|doc|1|0}} and {{#if:{{#translation:}}|1|0}} ) )|1|}}|[[Category:TemplateData documentation{{#translation:}}]]|[[Category:Templates using TemplateData{{#translation:}}]]}}}} | #default=
Script error: No such module "Template translation".
}} <templatedata> {
"description": "Template for creating a standard hatnote. A hatnote is a short note placed at the top of an article or section to direct users to related pages", "format": "inline", "params": { "1": {
"aliases": [ "text" ],
"label": "Text", "description": "This field should contain the text that will be displayed in the hatnote.", "type": "string", "required": true,
"example": "Insert text here."
},
"extraclasses": { "label": "Extra classes", "description": "Comma-separated list of CSS class names", "type": "string" }
}, "paramOrder": [ "1", "extraclasses" ]
} </templatedata>