Sjabloon:Redirect template/doc

Uit informatiestandaarden
Naar navigatie springen Naar zoeken springen

This is a template for standardising redirect templates. The message produced by this template is intended to be transcluded onto redirect pages via other redirect templates.

When transcluded into the namespace indicated by a parameter, it categorises that page according to the parameter. When transcluded into other templates, it places those templates into Category:All redirect templates. Therefore templates based on this one should not be used to tag redirect pages in the template namespace.

Usage

Only use this template in other redirect templates for hard redirects.

The only links that should be present on a redirect page are the link to the target page, and category and interwiki links that apply to the redirect. Other links on redirect pages cause problems with "What links here".

This template should be used twice in a redirect template:

{{#ifeq:{{{embed}}}|yes|{{Redirect template}}|{{Redirect template}}}}

The first half of the template will appear when used with {{This is a redirect}}, whereas the second half will appear when used without {{This is a redirect}}.

Parameters

All the parameters are technically optional (the template will work and appear normal without them); however, the template is pointless without parameters. All the parameters should be used, except only one of from and to needs to be used (both can be used) and printworthy should only be used where applicable. All parameters except name should be used in both halves of the template. Preferably, the parameters used in both halves should be identical (apart from a link in from or to).

The parameter |name=From example adds the text "From example:" before "This is a redirect". The text will be automatically linked to the redirect category corresponding to the redirect template. This parameter should be used only in the first half.

The parameter |from=example adds the text "from example" after "This is a redirect". The parameter |to=example adds the text "to example" after "This is a redirect" or the from parameter if that is also used. One of these two parameters should contain a bolded link to the redirect template's corresponding category in the second half.

The parameter |info=This is extra information. produces the text "This is extra information." after the first sentence, allowing extra information about the type of redirect to be displayed if necessary. Too much extra information should be avoided, as it can be included on the corresponding category page instead.

The category parameters add pages with redirect templates using this template to categories. Use the parameter for the namespace the template will be used in: |main category=R from example, |help category=, |portal category=, |talk category= (for all talk namespaces), |template category= or |wikipedia category=. Multiple category parameters may be used but it is unlikely that this will ever be necessary. |all category= adds the category to pages in any namespace. Parameters for other namespaces do not exist because no hard redirects should exist to or from those namespaces.

A namespace parameter can be used in conjunction with |other category=. This parameter will add its category to pages in any namespace other than the specified namespace parameter's. Do not use this parameter if multiple namespace parameters have been used.

The category parameters in the second half should be wrapped in <includeonly></includeonly> to stop the redirect template itself being placed in the categories or the {{Incorrect namespace}} message box appearing on the redirect template page. Do not "includeonly" the parameters in the first half because it will prevent the link being added to the text created by the name parameter.

The parameter |printworthy= will categorise main namespace pages into Category:Printworthy redirects or Category:Unprintworthy redirects depending whether the parameter equals "yes" or "no", respectively.

Example

{{#ifeq:{{{embed}}}|yes|{{Redirect template|name=From an alternative spelling|from=an alternative spelling of the target page name|to=a more common spelling or a spelling used in another variety of English|info=Extra information.|main category=Redirects from alternative spellings}}|{{Redirect template|from=an '''[[:Category:Redirects from alternative spellings|alternative spelling]]''' of the target page name|to=a more common spelling or a spelling used in another variety of English|info=Extra information.<includeonly>|main category=Redirects from alternative spellings</includeonly>}}}}

used by itself produces:

Sjabloon:Redirect template

used with {{This is a redirect}} produces:

Categorisation of redirect templates

This template automatically adds templates it is transcluded on to Category:All redirect templates, except sub-pages named "doc" (to avoid adding the category to documentation sub-pages of templates which contain examples of this template or redirect templates using this template). At the moment, the category is also added to template namespace pages that transclude redirect templates using this template. Until this setback has been fixed, this template should not be used on redirect templates that can be used on template namespace pages.