Difference between revisions of "Template:Tag"

Jump to navigation Jump to search
1,685 bytes added ,  4 years ago
no edit summary
m (tweak docs)
-->[[Category:{{{cat|{{{1}}}|}}}]]<!--
 
--></includeonly><noinclude>UseThe this'''tag''' template to linklinks to a page, and alsoadds addthe page it's on to a category. It's best to use it on the page's [[Help:Infoboxes|infobox]] rather than in the text proper.
 
=== Template ===
This template defaults to <code><nowiki>[[ {{{1}}} ]][[Category: {{{1}}} ]]</nowiki></code> but has named parameters and can be used as <code>[[ {{{link}}} | {{{text}}} ]][[Category: {{{cat}}} ]]</code>.
<pre class=mw-code>
{{tag |{{1}} |cat= |text= }}
</pre>
 
=== Parameters ===
Highlighted lines indicate '''mandatory''' parameters.
 
Positional parameters are indicated with <nowiki>{{N}}</nowiki> in their name. For example, <nowiki>{{1}}</nowiki> means "the first template parameter".
 
{{docs|title={{t|Tag}} Parameters}}
 
<!-- ------------- -->
<!-- ROW: {{1}} -->
<!-- ------------- -->
{{docs/row/required
|param=<nowiki>{{1}}</nowiki>
|desc= Use the first parameter to create a link and add the page to a category with the same name.
|eg=
<code><nowiki>|Diagram</nowiki></code>
}}
 
<!-- -------- -->
<!-- ROW: cat -->
<!-- -------- -->
{{docs/row/optional
|param=cat
|desc=Use this to add this page to a category named differently than the first parameter; if <code>cat</code> is used, the first parameter serves only as a page link.<br>
<small>'''Note:''' This is useful in cases such as when the first parameter links to a disambiguation page; for example, <code><nowiki>{{tag|Diagram}}</nowiki></code> would add the page to [[:Category:Diagram]] and link to [[Diagram]], while <code><nowiki>{{tag|Diagram (group)|cat=Diagram}}</nowiki></code> adds the page to [[:Category:Diagram]] and links to [[Diagram (group)]].</small>
|eg=
<code><nowiki>|cat=Diagram</nowiki></code>
}}
 
<!-- -------- -->
<!-- ROW: text -->
<!-- -------- -->
{{docs/row/optional
|param=text
|desc=Use this to change how the tag is displayed on the page.<br>
<small>'''Note:''' To follow from the above example, <code><nowiki>{{tag|Diagram (group)|cat=Diagram|text=Patriots}}</nowiki></code> adds the page to [[:Category:Diagram]], links to [[Diagram (group)]] and displays the tag as [[Diagram (group)|Patriots]].</small>
|eg=
<code><nowiki>|text=Patriots</nowiki></code>
}}
 
|}
 
[[Category: link macros]]
Editors, Keepers
8,240

edits

Navigation menu