Module:Redirect/doc
![]() | This is a documentation subpage for Module:Redirect. It may contain usage information, categories and other content that is not part of the original module page. |
![]() | This Lua module is used in system messages, and on approximately 4,790,000 pages, or roughly 8% of all pages. Changes to it can cause immediate changes to the Wikipedia user interface. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Please discuss changes on the talk page before implementing them. |
This module accepts the name of a single page. It determines if the page is a redirect; if so it looks up the page, extracts the target, and returns the target name as text. Its usage is {{#invoke:redirect|main|redirect-page-name}}.
The template normally neither takes nor gives square brackets, so to show the result as a link use [[{{#invoke:redirect|main|redirect-page-name}}]]. An error is produced if the redirect does not exist, but for versatility no error is given if the file is not a redirect (returns the original text) or if the file name is blank (returns blank).
However, if the parameter bracket is given a nonblank value, brackets will be passed on if present.
Examples
{{#invoke:redirect|main|WP:AFC}}
produces
Wikipedia:Articles for creation
{{#invoke:redirect|main|[[WP:AFD]]|bracket=yes}}
produces
Wikipedia:Articles for deletion
If the target isnt a redirect:
{{#invoke:redirect|main|Wikipedia:Articles for deletion|}}
produces
Wikipedia:Articles for deletion