Template:Redirect template/doc: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[checked revision][checked revision]
Content added Content deleted
(add nocat option and fix newlines)
(update example)
Line 3: Line 3:
* <code><nowiki>{{{1}}}</nowiki></code>: name of category being added.
* <code><nowiki>{{{1}}}</nowiki></code>: name of category being added.
* <code><nowiki>{{{2}}}</nowiki></code>: text to display after "this redirect".
* <code><nowiki>{{{2}}}</nowiki></code>: text to display after "this redirect".
Templates built using this template can generate documentation using [[Template:Redirect template/doc template]]:
Templates built using this template can generate documentation using [[Template:Redirect template/doc template]] (which automatically adds [[:Category:Redirect templates]], unless <code>nocat</code> is set):
<syntaxhighlight lang="mediawiki">
<syntaxhighlight lang="mediawiki">
<noinclude>{{Template:Redirect template/doc template|Category name}}</noinclude>
{{Redirect template|Redirects|is in the top-level redirects category!}}<noinclude>{{Documentation|Template:Redirect template/doc template|content=
{{Redirect template/doc template|Redirects}}
}}</noinclude>
</syntaxhighlight>
</syntaxhighlight>
Which would produce:
Where the category name should match the first positional argument passed to the main template.<!--
{{Redirect template|Redirects|is in the top-level redirects category!}}{{Documentation|Template:Redirect template/doc template|content=
{{Redirect template/doc template|Redirects|nocat=1}}
}}<!--
-->{{#if:{{{nocat|}}}||[[Category:Meta-templates]]}}
-->{{#if:{{{nocat|}}}||[[Category:Meta-templates]]}}

Revision as of 21:59, 18 June 2024

This is a template documentation page

This template is a meta-template for redirect templates that assign a category to the redirect. They are meant to be transcluded in the first positional argument of Template:Redirect page. It takes following arguments:

  • {{{1}}}: name of category being added.
  • {{{2}}}: text to display after "this redirect".

Templates built using this template can generate documentation using Template:Redirect template/doc template (which automatically adds Category:Redirect templates, unless nocat is set):

{{Redirect template|Redirects|is in the top-level redirects category!}}<noinclude>{{Documentation|Template:Redirect template/doc template|content=
{{Redirect template/doc template|Redirects}}
}}</noinclude>

Which would produce:

Template documentation

Transcluded from Template:Redirect template/doc template

This template is supposed to be transcluded inside the first positional argument of Template:Redirect page. Assigns the category Category:Redirects, unless template argument nocat is set.