Template:randommainpage

From Homestar Runner Wiki

(Difference between revisions)
Jump to: navigation, search
m (Template:mainpage moved to Template:randommainpage: add random to the name)
(Usage: better wording)
 
(includes 13 intermediate revisions)
Line 1: Line 1:
<includeonly>{{#setvar: Total_Main_Pages | {{#expr:  
<includeonly>{{#setvar: Total_Main_Pages | {{#expr:  
-
24 <!-- number of regular main pages                 -->  + {{#setvar: Special_Main_Pages |
+
{{#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>{{mainpage}}</nowiki></code>: {{mainpage}}
+
*<code><nowiki>{{randommainpage}}</nowiki></code>: {{randommainpage}}
-
*<code><nowiki>[[HR:{{mainpage}}.html]]</nowiki></code>: [[HR:{{mainpage}}.html]]
+
*<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:Formatting Templates]]</noinclude>
+
[[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}}: main20
  • {{randommainpage|oldhr=true}}: main20 (excludes any main pages after 26)
  • [[HR:{{randommainpage}}.html]]: HR:main20.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.
Personal tools