Template:randommainpage
From Homestar Runner Wiki
(Difference between revisions)
It's dot com (Talk | contribs) (new name'd) |
(→Usage: better wording) |
||
(includes 12 intermediate revisions) | |||
Line 1: | Line 1: | ||
<includeonly>{{#setvar: Total_Main_Pages | {{#expr: | <includeonly>{{#setvar: Total_Main_Pages | {{#expr: | ||
- | + | {{#if:{{{oldhr|}}}| | |
- | 3 <!-- number of special main pages; see list below --> |show}} }} | + | 26 <!-- number of regular main pages on the Flash archive -->| |
+ | 27 <!-- number of regular main pages -->}} + {{#setvar: Special_Main_Pages | | ||
+ | 3 <!-- number of special main pages; see list below --> |show}} }} | ||
}}{{#switch: {{#setvar: Get_Main_Page | {{#rand: {{#var:Total_Main_Pages}} }} |show|check}} | }}{{#switch: {{#setvar: Get_Main_Page | {{#rand: {{#var:Total_Main_Pages}} }} |show|check}} | ||
Line 12: | Line 14: | ||
| <!-- default --> main{{#expr: {{#var:Get_Main_Page}} - {{#var:Special_Main_Pages}} }} | | <!-- default --> main{{#expr: {{#var:Get_Main_Page}} - {{#var:Special_Main_Pages}} }} | ||
- | }}</includeonly><noinclude>Returns the filename of a random main page, including the special main pages. | + | }}</includeonly><noinclude>Returns the filename of a random main page, including the special main pages (with the exception of the [[Strong Bad Main Page]], which doesn't have its own URL). |
+ | |||
+ | The same value is returned for every instance of the template on a given page (the template only chooses a random number once per page). | ||
---- | ---- | ||
===Usage=== | ===Usage=== | ||
*<code><nowiki>{{randommainpage}}</nowiki></code>: {{randommainpage}} | *<code><nowiki>{{randommainpage}}</nowiki></code>: {{randommainpage}} | ||
+ | *<code><nowiki>{{randommainpage|oldhr=true}}</nowiki></code>: {{randommainpage|oldhr=true}} ''(excludes any main pages after [[Main Page 26|26]])'' | ||
*<code><nowiki>[[HR:{{randommainpage}}.html]]</nowiki></code>: [[HR:{{randommainpage}}.html]] | *<code><nowiki>[[HR:{{randommainpage}}.html]]</nowiki></code>: [[HR:{{randommainpage}}.html]] | ||
- | [[Category: | + | ===To update=== |
+ | *Increment the number of regular main pages whenever a new one is added. | ||
+ | *To add a special main page, increment the appropriate number and add the filename to the lower list. | ||
+ | |||
+ | [[Category:Link Box Templates|{{PAGENAME}}]]</noinclude> |
Current revision as of 10:26, 6 January 2022
Returns the filename of a random main page, including the special main pages (with the exception of the Strong Bad Main Page, which doesn't have its own URL).
The same value is returned for every instance of the template on a given page (the template only chooses a random number once per page).
[edit] Usage
{{randommainpage}}
: main16{{randommainpage|oldhr=true}}
: main16 (excludes any main pages after 26)[[HR:{{randommainpage}}.html]]
: HR:main16.html
[edit] To update
- Increment the number of regular main pages whenever a new one is added.
- To add a special main page, increment the appropriate number and add the filename to the lower list.