Template:Category/doc: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Added documentation subpage for Template:Category.)
 
(Corr.)
 
(3 intermediate revisions by the same user not shown)
Line 5: Line 5:
This template produces a link to a category. It's meant to be an easier way to link to categories.
This template produces a link to a category. It's meant to be an easier way to link to categories.


The current syntax, <nowiki>[[:Category:Category Name]]</nowiki>, is confusingly similar to the syntax for adding a page to a category, <nowiki>[[Category:Category Name]]</nowiki> (only a single colon character differs).
The current syntax for creating a link to a category, <nowiki>[[:Category:Category Name]]</nowiki>, is confusingly similar to the syntax for adding a page to a category, <nowiki>[[Category:Category Name]]</nowiki> (only a single colon character differs).


=== Parameters ===
=== Parameters ===
<nowiki>{{Category|Name}}</nowiki>
The syntax for {{tl|category}} is <code><nowiki>{{category|category name|link text}}</nowiki></code>, where
* '''Name''' the name of the category to which you want to link.
* '''category name''' is the name of the category to which you want to link.
* '''link text''' is an alternative text for the link, that is displayed instead of the standard output "Category:Category name".


(The category name doesn't include the preceding "Category:", so if you want to link to a category called Mozilla, you just write "Mozilla" and not "Category:Mozilla".)
'''NB!''' The template automatically includes the preceding namespace, "Category:". Hence, if you, as an example, want to link to a category called Mozilla, you just enter "Mozilla".


== Example ==
== Examples ==
* <nowiki>{{Category|L10n}}</nowiki> produces the link {{Category|L10n}}
* <code><nowiki>{{category|L10n}}</nowiki></code> gives {{Category|L10n}}
* <nowiki>{{Category|Mozilla}}</nowiki> produces the link {{Category|Mozilla}}
* <code><nowiki>{{category|Gurkburk}}</nowiki></code> gives {{Category|Gurkburk}}


(If the resulting link is displayed in red, it means that the category you wished to link to doesn't exist yet. Click the link to go to the page for creating that category.)
* <code><nowiki>{{category|L10n|localization}}</nowiki></code> gives {{Category|L10n|localization}}
* <code><nowiki>{{category|Gurkburk|This category doesn't exist! (Yet)}}</nowiki></code> gives {{Category|Gurkburk|This category doesn't exist! (Yet)}}
 
If the resulting link is displayed in red, it means that the category you wished to link to doesn't exist yet. Click the link to go to the page for creating that category.
 
== See also ==
* {{tl|c}} – same function as this template, but without the option to add a custom link text.


<includeonly>
<includeonly>

Latest revision as of 15:16, 1 December 2014

Edit-copy green.svg
This is a documentation subpage for Template:Category.
It contains usage information, categories and other content that is not part of the original template page.

Usage

This template produces a link to a category. It's meant to be an easier way to link to categories.

The current syntax for creating a link to a category, [[:Category:Category Name]], is confusingly similar to the syntax for adding a page to a category, [[Category:Category Name]] (only a single colon character differs).

Parameters

The syntax for {{category}} is {{category|category name|link text}}, where

  • category name is the name of the category to which you want to link.
  • link text is an alternative text for the link, that is displayed instead of the standard output "Category:Category name".

NB! The template automatically includes the preceding namespace, "Category:". Hence, if you, as an example, want to link to a category called Mozilla, you just enter "Mozilla".

Examples

If the resulting link is displayed in red, it means that the category you wished to link to doesn't exist yet. Click the link to go to the page for creating that category.

See also

  • {{c}} – same function as this template, but without the option to add a custom link text.