Template:Random page in category: Difference between revisions
Appearance
Content deleted Content added
fix urlencode |
{{#ifeq:{{{type|}}}|subcat|category|{{{type|page}}}}} |
||
Line 1: | Line 1: | ||
{{#if:{{#ifeq:{{NAMESPACENUMBER}}|14|*|{{{1<includeonly>|</includeonly>}}}}} |
{{#if:{{#ifeq:{{NAMESPACENUMBER}}|14|*|{{{1<includeonly>|</includeonly>}}}}} |
||
|<span class="plainlinks">[//RandomInCategory.toolforge.org/{{urlencode:{{{1|{{PAGENAME}}}}}|WIKI}}?site={{urlencode:{{SERVERNAME}}|WIKI}}{{#if:{{{ns|}}}|&namespace={{urlencode:{{{ns}}}|WIKI}}}}{{#if:{{{type|}}}|&type={{urlencode:{{{type}}}|WIKI}}}}{{#if:{{{action|}}}|&action={{urlencode:{{{action}}}|WIKI}}}} {{{text|Random {{{type|page}}} in {{#if:{{{1|}}}|category {{{1}}}|this category}}}}}]</span> |
|<span class="plainlinks">[//RandomInCategory.toolforge.org/{{urlencode:{{{1|{{PAGENAME}}}}}|WIKI}}?site={{urlencode:{{SERVERNAME}}|WIKI}}{{#if:{{{ns|}}}|&namespace={{urlencode:{{{ns}}}|WIKI}}}}{{#if:{{{type|}}}|&type={{urlencode:{{{type}}}|WIKI}}}}{{#if:{{{action|}}}|&action={{urlencode:{{{action}}}|WIKI}}}} {{{text|Random {{#ifeq:{{{type|}}}|subcat|category|{{{type|page}}}}} in {{#if:{{{1|}}}|category {{{1}}}|this category}}}}}]</span> |
||
|{{Error|Error: A category needs to be specified or this template needs to be placed on a category page}} |
|{{Error|Error: A category needs to be specified or this template needs to be placed on a category page}} |
||
}}<noinclude> |
}}<noinclude> |
Revision as of 20:36, 28 June 2020
This template is used on approximately 4,800 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
This template creates a link to random page from a category.
Usage
- First parameter is the category from which to get a random page. If it is not specified, it defaults to current page, which works only on category pages.
- Parameter
|ns=
is for specifying the namespace number. Separate multiple namespace numbers with;
or!
(e.g.|ns=2;118
) - Parameter
|type=
specified the type of page to return (page
,subcat
, orfile
).|type=page
,|type=subcat
, and|type=file
are equivalent to|ns=0
,|ns=14
, and|ns=6
, respectively. - Parameter
|action=
specifies an action to perform on the page (e.g.|action=edit
). See Parameters to index.php§Actions. - Parameter
|text=
is for specifying different link text.
TemplateData
No description.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Category | 1 | Category from which page will be selected | Page name | optional |
Namespace | ns | no description | Unknown | optional |
type | type | no description | Unknown | optional |
action | action | no description | Unknown | optional |
text | text | no description | Unknown | optional |
Examples
{{Random page in category}}
would produce on Category:Physics: Random page in category Physics{{Random page in category|Physics}}
produces: Random page in category Physics{{Random page in category|Physics|text=Random page}}
produces: Random page{{Random page in category|Pending AfC submissions|ns=2;118|type=page}}
produces: Random page in category Pending AfC submissions{{Random page in category|States of the United States|type=subcat}}
produces: Random category in category States of the United States{{Random page in category|Featured pictures|type=file}}
produces: Random file in category Featured pictures{{Random page in category|Primary colors|action=edit|type=page|text=Edit an article about a primary color}}
produces: Edit an article about a primary color
See also
- Random page in category on toolserver – the tool this template is based upon