Template:randommainpage
From Homestar Runner Wiki
(Difference between revisions)
It's dot com (Talk | contribs) (returns the filename of a random main page) |
(→Usage: better wording) |
||
(includes 16 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}} |
<!-- list of special main pages --> | <!-- list of special main pages --> | ||
Line 11: | Line 13: | ||
| 3 = mainking | | 3 = mainking | ||
- | | <!-- 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>{{ | + | *<code><nowiki>{{randommainpage}}</nowiki></code>: {{randommainpage}} |
- | *<code><nowiki>[[HR:{{ | + | *<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]] | ||
+ | |||
+ | ===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: | + | [[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}}
: luaumain{{randommainpage|oldhr=true}}
: luaumain (excludes any main pages after 26)[[HR:{{randommainpage}}.html]]
: HR:luaumain.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.