CupertinoGuide/MakingYourFirstTemplate
![]() Thank you for your interest in the Cupertino Guide. We are currently moving to guides.micronations.wiki, please use that link if you want to see the Cupertino Guide in the future. The naming standard for the Cupertino Guide on guides.micronations.wiki will also be changed; refer to Guides:Changed naming standard.
|
Recommended skill level | |
Advanced | |
This covers an advanced topic. Lots of experience in MicroWiki editing, writing, the fundamentals may be required for this lesson. |
As we alluded to in the last lesson, templates are just containers of information that can be shared between various wiki pages. This means that you can basically put anything in Templates, so let's go over what templates should optimally be used for, as well as how to make one. We recommend only building templates using source editor.
Should I make this a template?
Templates should really be made for at least one of these purposes:
- If it contains lots of complicated markup;
- For formatting purposes (like on the MicroWiki front page);
- If it is meant to be used on other pages.
If it doesn't fulfill those criteria, it is recommended to incorporate the template on your page. This is because templates can be less convenient to edit as you have to find the template page to edit it, and you won't be able to preview the whole page when you edit your template.
Creating your template page
On CupertinoGuide/What is MicroWiki, we told you that template pages start with Template:
. Knowing this, go create your page, and start your page title with Template:
. After the colon, name your template (you can use spaces and symbols).
For the example above, the template's name would be Cupertino Alliance
. To use the template, do {{Cupertino Alliance}}
.
Naming for infobox templates
It is usual for infobox templates to usually be named as Template:Infobox <thing>
. If you plan to make an infobox template, ensure that you name it this way.
Template special characters
There are two important special characters that are used in templates.
Three curly parentheses with a vertical line
The three curly parentheses with a vertical line indicate a parameter you can fill in. These would usually look like:
{{{Cupertino Alliance Factbook|}}}
which will allow you to fill in a value for the parameter "Cupertino Alliance Factbook"
|Cupertino Alliance Factbook = <value>
If statement
An if statement means that something needs to be fulfilled in order for an action to be done. This looks like:
{{#if:{{{parameter1|}}}|{{{parameter2|}}}}}
This translates to:
- If
{{{parameter1|}}}
has a value, then{{{parameter2|}}}
will appear.
Also take the example from last lesson, where |head of state =
wasn't appearing because |hos_name =
's value was missing.
Obamaland | |
---|---|
Government |
{{subst:infobox nation/skin |name = Obamaland |head of state = President}}
The above example failed to appear, telling us that the label or data parameters may have an "if" template.
...this can mean that you will have to fulfill both of those parameters in order for a label to appear. Take the below example.
|label19 = {{#if:{{{head of state|}}}|<small> - {{{head of state|}}}</small>}}
|data19 = {{#if:{{{hos_name|}}}|<small>{{{hos_name|}}}</small>}}
{{#if:{{{head of state|}}}|<small> - {{{head of state|}}}</small>}}
tells us that we need to fulfill |head of state =
in order for |hos_name =
to appear, with the text of |head of state =
being small.
Obamaland | |
---|---|
Government | |
• President | Obama |
{{subst:infobox nation/skin |name = Obamaland |head of state = President |hos_name = Obama}}
Creating text templates
To create pages with just text and photos (i.e. no infoboxes), simply write like you are writing a wiki page. Once you are done, save it and use it.
Creating text templates with a parameter
To create one with text you can enter, consider the example below:
Pencils are better than pens because {{{reason|}}}
This allows us to type in a reason into the |reason =
parameter. Naming our template Template:CupertinoGuidePencil, the final product can look like:
- Pencils are better than pens because you can erase them.
{{CupertinoGuidePencil |reason = you can erase them.}}
We can also add boldness, italics, hyperlinks, and more like this:
I really like [[w:{{{Youtuber|}}}|{{{Youtuber|}}}]] who lives in the '''State of {{{State|}}}''' and makes videos like ''{{{Video|}}}''!
The formatting may look strange when you preview it, but continue. Naming our template Template:CupertinoGuideNorthCarolina, the final product can look like:
- I really like MrBeast who lives in the State of North Carolina and makes videos like "Selling homes for $1"!
{{CupertinoGuideNorthCarolina |Youtuber = MrBeast |State = North Carolina |Video = "Selling homes for $1"}}
Of course, if you plan to make templates for main space pages, make sure they use encyclopedia-appropriate language.
Creating text templates with an if statement
To create one with an if statement, consider the following example below:
The State of [[Vishwamitra]] is a micronation. {{#if:{{{location|}}}|It is located in [[w:India|India]]}}.
Naming our template Template:CupertinoGuideVishwamitra, it would look like:
- The State of Vishwamitra is a micronation. .
{{CupertinoGuideVishwamitra}}
If we add something to |location =
however, it would look like:
- The State of Vishwamitra is a micronation. It is located in India.
{{CupertinoGuideVishwamitra |location = yes}}
Notice how the value in |location =
(in this case, "yes") does not appear. The if statement works however since a value is added- it doesn't care what is in the value however. If we want the text in the value to appear, consider this:
The Kingdom of [[Atiera]] is a member of the Cupertino Alliance. {{#if:{{{dateofadmission|}}}|It was admitted on {{{dateofadmission|}}}.}}
Naming our template Template:CupertinoGuideAtiera, it would look like:
- The Kingdom of Atiera is a member of the Cupertino Alliance.
{{Template:CupertinoGuideAtiera}}
If we added the date of admission for Atiera in |dateofadmission =
however, it would look like:
- The Kingdom of Atiera is a member of the Cupertino Alliance. It was admitted on 7 July 2020.
{{Template:CupertinoGuideAtiera |dateofadmission = 7 July 2020}}
Notice how "7 July 2020" appears in the bottom example, but we didn't add "7 July 2020" in our original template text. This is because we used {{{dateofadmission|}}}
on both sides of the if statement, as opposed to our first example where {{{location|}}}
appeared only on the left.
Creating infobox templates
There are two ways to make infobox templates:
- Template:Infobox
- Using a table
Both have their upsides. Template:Infobox is easier to build and you do not have to add if statements to everything. The table method however is more customizable. Please note that Template:Infobox is more popular and considered the "modern" method.
Using Template:Infobox
Infobox templates use Template:Infobox. Start your template page with
{{Infobox
The template uses |data =
and |label =
. Each data and label corrisponds to a number, for example:
|data2 =
will connect to|label2 =
Note that you do not have to have every data parameter connected up, but each label needs to be connected to a data parameter. For example:
|data1 =
works by itself.|label2 =
will not work without|data2 =
Singular data sections are usually used for titles or sections.
Let's start with a title. Type in |data1 = {{#if:{{{name|}}}|<big>''' {{{name|}}} '''</big>}}
. This will allow |data1 =
to hide if the user chooses not to have a title. Our text should look like:
{{Infobox |data1 = {{#if:{{{name|}}}|<big>''' {{{name|}}} '''</big>}}
Let's add an area to add a photo:
{{Infobox |data1 = {{#if:{{{name|}}}|<big>''' {{{name|}}} '''</big>}} |data2 = {{{photo|}}}
...a couple labels and data parameters:
{{Infobox |data1 = {{#if:{{{name|}}}|<big>''' {{{name|}}} '''</big>}} |data2 = {{{photo|}}} |label3 = Established |data3 = {{{established|}}} |label4 = Currency unit |data4 = {{{currency|}}}
Let's create a new section. We can do that with a singular data parameter.
{{Infobox |data1 = {{#if:{{{name|}}}|<big>''' {{{name|}}} '''</big>}} |data2 = {{{photo|}}} |label3 = Established |data3 = {{{established|}}} |label4 = Currency unit |data4 = {{{currency|}}} |data5 = Currency information
For the inflation rate, let's use the currency name. For that, use {{{currency|}}}
.
{{Infobox |data1 = {{#if:{{{name|}}}|<big>''' {{{name|}}} '''</big>}} |data2 = {{{photo|}}} |label3 = Established |data3 = {{{established|}}} |label4 = Currency unit |data4 = {{{currency|}}} |data5 = Currency information |label6 = {{{currency|}}} inflation rate |data6 = {{{inflation|}}} |label7 = Issuer |data7 = {{{bank|}}}
Let's end our template with }}
and it should look like:
{{Infobox |data1 = {{#if:{{{name|}}}|<big>''' {{{name|}}} '''</big>}} |data2 = {{{photo|}}} |label3 = Established |data3 = {{{established|}}} |label4 = Currency unit |data4 = {{{currency|}}} |data5 = Currency information |label6 = {{{currency|}}} inflation rate |data6 = {{{inflation|}}} |label7 = Issuer |data7 = {{{bank|}}} }}
Weg Gogo | |
![]() | |
Currency unit | Gogo |
---|---|
Currency information |
Let's name our template Template:CupertinoGuideCurrency. If we use our template now, it looks good- however if I don't have anything listed for {{{inflation|}}}
or {{{bank|}}}
, "Currency information" still appears!
{{CupertinoGuideCurrency |name = Weg Gogo |photo = [[File:Gogo2.jpeg|150px]] |currency = Gogo }}
To fix this, let's add an if template to |data5 =
{{Infobox |data1 = {{#if:{{{name|}}}|<big>''' {{{name|}}} '''</big>}} |data2 = {{{photo|}}} |label3 = Established |data3 = {{{established|}}} |label4 = Currency unit |data4 = {{{currency|}}} |data5 = {{#if:{{{inflation|}}}{{{bank|}}}|Currency information}} |label6 = {{{currency|}}} inflation rate |data6 = {{{inflation|}}} |label7 = Issuer |data7 = {{{bank|}}} }}
This if statement is a bit different. If either {{{inflation|}}}
and / or {{{bank|}}}
has a value, then "currency information" appears. Save and name it Template:CupertinoGuideCurrency two
Weg Gogo | |
![]() | |
Currency unit | Gogo |
---|
{{CupertinoGuideCurrency two |name = Weg Gogo |photo = [[File:Gogo2.jpeg|150px]] |currency = Gogo }}
Here is the template with everything on it:
Weg Gogo | |
![]() | |
Established | 2020 |
---|---|
Currency unit | Gogo |
Currency information | |
Gogo inflation rate | 4.2% |
Issuer | Bank of Wegmat |
{{CupertinoGuideCurrency two |name = Weg Gogo |photo = [[File:Gogo2.jpeg|150px]] |established = 2020 |currency = Gogo |inflation = 4.2% |bank = Bank of Wegmat }}
Feel free to add more or fewer sections, data, or labels to fit your needs. And that is your first infobox template!
Additional styles
If you look in the text of Template:Infobox country, it would show additional styles:
| bodyclass = geography vcard | bodystyle = font-size:88%; | headerstyle= text-align:left; | aboveclass = adr | abovestyle = padding:0.25em 0.33em 0.33em;line-height:1.2em;font-size:1.25em;
You can add some or all of these styles to your infobox for a new look.
{{Infobox | bodyclass = geography vcard | bodystyle = font-size:88%; | headerstyle= text-align:left; | aboveclass = adr | abovestyle = padding:0.25em 0.33em 0.33em;line-height:1.2em;font-size:1.25em; |data1 = {{#if:{{{name|}}}|<big>''' {{{name|}}} '''</big>}} |data2 = {{{photo|}}} |label3 = Established |data3 = {{{established|}}} |label4 = Currency unit |data4 = {{{currency|}}} |data5 = {{#if:{{{inflation|}}}{{{bank|}}}|Currency information}} |label6 = {{{currency|}}} inflation rate |data6 = {{{inflation|}}} |label7 = Issuer |data7 = {{{bank|}}} }}
Naming the infobox Template:CupertinoGuideCurrency three, it would look like: Here is the template with everything on it: Template:CupertinoGuideCurrency three
{{CupertinoGuideCurrency three |name = Weg Gogo |photo = [[File:Gogo2.jpeg|150px]] |established = 2020 |currency = Gogo |inflation = 4.2% |bank = Bank of Wegmat }}
Creating infoboxes like a table
Recommended resources
|
---|
You might need to retrieve an HTML colour code for the colour of your template. We recommend using https://htmlcolorcodes.com/.
Legal disclaimer: the Cupertino Alliance and MicroWiki have not been paid nor contacted by HTML Color Codes. |
Infoboxes can also be created like a table. To start, type out:
{|class="infobox" style="text-align: left; width: 23em"
Feel free to amend text-align and width values, but this is the standard measurements used in MicroWiki. Let's add a title, but a reminder since this is a table, every element needs to be divided using |-
.
{|class="infobox" style="text-align: left; width: 23em |- ! style="text-align: center; background:#BFDFFF" colspan="2" | {{{Title|}}}
Feel free to change the background colour to any HTML colour code. If you want to change the text colour, use color:
. If you know CSS, this is basically what we are doing here.
{| class="infobox" style="font-size: 90%; text-align: left; width: 23em" |- ! style="text-align: center; background:#BFDFFF; color:#404040"; colspan="2" | {{{Title|}}}
Let's add an image. Since we set the colspan
to two, if we want to set things to the centre, it has to fill up two columns and be aligned to the centre.
{| class="infobox" style="font-size: 90%; text-align: left; width: 23em" |- ! style="text-align: center; background:#BFDFFF; color:#404040"; colspan="2" | {{{Title|}}} |- | style="text-align: center" colspan="2" | [[File:CupertinoPan.svg|150px]]
Let's add labels and data. Labels start with !
whilst data starts with |
.
{| class="infobox" style="font-size: 90%; text-align: left; width: 23em" |- ! style="text-align: center; background:#BFDFFF; color:#404040"; colspan="2" | {{{Title|}}} |- | style="text-align: center" colspan="2" | [[File:CupertinoPan.svg|150px]] |- ! Launched | {{{launch|}}} |- ! Members as of {{{date|}}} | {{{members|}}}
Let's add a column.
{| class="infobox" style="font-size: 90%; text-align: left; width: 23em" |- ! style="text-align: center; background:#BFDFFF; color:#404040"; colspan="2" | {{{Title|}}} |- | style="text-align: center" colspan="2" | [[File:CupertinoPan.svg|150px]] |- ! Launched | {{{launch|}}} |- ! Members as of {{{date|}}} | {{{members|}}} |- | style="text-align: center" colspan="2" | Location information
...and another label + data, and end it off with |}
(considering this is a table).
{| class="infobox" style="font-size: 90%; text-align: left; width: 23em" |- ! style="text-align: center; background:#BFDFFF; color:#404040"; colspan="2" | {{{Title|}}} |- | style="text-align: center" colspan="2" | [[File:CupertinoPan.svg|150px]] |- ! Launched | {{{launch|}}} |- ! Members as of {{{date|}}} | {{{members|}}} |- | style="text-align: center" colspan="2" | Location information |- ! Headquarters | {{{headquarters|}}} |}
Let's save it as Template:CupertinoGuideTemplateTable. If we attempt to use it with some parameters filled, a couple of the labels will appear without data.
Cupertino Alliance | |
---|---|
![]() | |
Launched | 28 January 2020 |
Members as of | |
Location information | |
Headquarters |
{{CupertinoGuideTemplateTable |Title = Cupertino Alliance |launch = 28 January 2020}}
This is because unlike templates based on Template:Infobox, every label and data using this method needs to have an if template. Let's do that.
{| class="infobox" style="font-size: 90%; text-align: left; width: 23em" |- ! style="text-align: center; background:#BFDFFF; color:#404040"; colspan="2" | {{{Title|}}} |- | style="text-align: center" colspan="2" | [[File:CupertinoPan.svg|150px]] |- ! {{#if:{{{launch|}}}|Launched }} | {{#if:{{{launch|}}}|{{{launch|}}} }} |- ! {{#if:{{{members|}}}|Members as of {{{date|}}} }} | {{#if:{{{members|}}}|{{{members|}}} }} |- | style="text-align: center" colspan="2" | {{#if:{{{headquarters|}}}|Location information}} |- ! {{#if:{{{headquarters|}}}|Headquarters }} | {{#if:{{{headquarters|}}}|{{{headquarters|}}} }} |}
Save it as Template:CupertinoGuideTemplateTable two. Let's use it:
Cupertino Alliance | |
---|---|
![]() | |
Launched | 28 January 2020 |
{{CupertinoGuideTemplateTable two |Title = Cupertino Alliance |launch = 28 January 2020}}
...and with everything
Cupertino Alliance | |
---|---|
![]() | |
Launched | 28 January 2020 |
Members as of 30 April 2021 | 27 |
Location information | |
Headquarters | Point Cupertino |
{{CupertinoGuideTemplateTable two |Title = Cupertino Alliance |launch = 28 January 2020 |members = 27 |date = 30 April 2021 |headquarters = Point Cupertino}}
Navbar templates utilize Template:Navbox. Start with {{Navbox
, then a |name =
parameter. The name parameter must line up with the title of you page (without the Template: prefix). For example, in Template:CupertinoAllianceGuideNavbarExample, use CupertinoAllianceGuideNavbarExample.
{{Navbox |name = CupertinoAllianceGuideNavbarExample
Then, add the Navbar title. This will appear at the top of the Navbar, and usually contains the flag of your nation, with a link to the main topic's page. For example, in the Cupertino Alliance template, it uses:
The text looks like:
{{Navbox |name = CupertinoAllianceGuideNavbarExample |title = [[File:CupertinoPan.svg|x12px|border|link=]] [[Cupertino Alliance]]
Then add the styles and colour. Again, you can customize the colours using HTML colour codes.
{{Navbox |name = CupertinoAllianceGuideNavbarExample |title = [[File:CupertinoPan.svg|x12px|border|link=]] [[Cupertino Alliance]] Then add the styles and colour. Again, you can customize the colours using HTML colour codes. |liststyle = padding:0.25em 0; line-height:1.4em; |oddstyle = background:#f7f7f7; |evenstyle = background:transparent; |groupstyle = text-align:center;
You can add an image, which will appear on the right of the nav bar.
{{Navbox |name = CupertinoAllianceGuideNavbarExample |title = [[File:CupertinoPan.svg|x12px|border|link=]] [[Cupertino Alliance]] |liststyle = padding:0.25em 0; line-height:1.4em; <!--otherwise lists can appear to form continuous whole--> |oddstyle = background:#f7f7f7; |evenstyle = background:transparent; |groupstyle = text-align:center; |image = [[File:Cupertinologo2.svg|150px]]
If you want the Navbar to auto-collaspe, then add |state = collapsed
. If you want the Navbar to not collapse, don't add anything in the |state =
parameter.
{{Navbox |name = CupertinoAllianceGuideNavbarExample |title = [[File:CupertinoPan.svg|x12px|border|link=]] [[Cupertino Alliance]] |liststyle = padding:0.25em 0; line-height:1.4em; <!--otherwise lists can appear to form continuous whole--> |oddstyle = background:#f7f7f7; |evenstyle = background:transparent; |groupstyle = text-align:center; |image = [[File:Cupertinologo2.svg|150px]] |state = collapsed
The Navbar is made out of groups and lists. Like infobox templates, they are connected through their number. Each group must connect with a list.
Let's add a couple of lists and groups.
{{Navbox |name = CupertinoAllianceGuideNavbarExample |title = [[File:CupertinoPan.svg|x12px|border|link=]] [[Cupertino Alliance]] |liststyle = padding:0.25em 0; line-height:1.4em; <!--otherwise lists can appear to form continuous whole--> |oddstyle = background:#f7f7f7; |evenstyle = background:transparent; |groupstyle = text-align:center; |image = [[File:Cupertinologo2.svg|150px]] |state = collapsed |group1 = Projects |list1 = [[Cupertino Alliance Factbook]] {{*}} [[List of CESE election graphics|Election graphics]] {{*}} [https://docs.google.com/document/d/1fxy1y3kNeA7aItbShKTt87vkyXMSwEkOp3dAFiidAZ0/edit?usp=sharing Edinburgh] |group2 = Documents |list2 = [[Charter of the Cupertino Alliance]] {{*}} ''[[Regional Sessions Act]]''
Let's add a subgroup using Navbox|child
. Add a |group =
and give it a name. Then, add the subgroup into the |label = .
{{Navbox |name = CupertinoAllianceGuideNavbarExample |title = [[File:CupertinoPan.svg|x12px|border|link=]] [[Cupertino Alliance]] |liststyle = padding:0.25em 0; line-height:1.4em; <!--otherwise lists can appear to form continuous whole--> |oddstyle = background:#f7f7f7; |evenstyle = background:transparent; |groupstyle = text-align:center; |image = [[File:Cupertinologo2.svg|150px]] |state = collapsed |group1 = Projects |list1 = [[Cupertino Alliance Factbook]] {{*}} [[List of CESE election graphics|Election graphics]] {{*}} [https://docs.google.com/document/d/1fxy1y3kNeA7aItbShKTt87vkyXMSwEkOp3dAFiidAZ0/edit?usp=sharing Edinburgh] |group2 = Documents |list2 = [[Charter of the Cupertino Alliance]] {{*}} ''[[Regional Sessions Act]]'' |group3 = People |list3 = {{navbox|child
Continue using groups and lists, but during the Navbox subgroup, start from 1. For viewing purposes, groups and lists under a Navbox subgroup will have an additional spacing (it is optional but recommended).
{{Navbox |name = CupertinoAllianceGuideNavbarExample |title = [[File:CupertinoPan.svg|x12px|border|link=]] [[Cupertino Alliance]] |liststyle = padding:0.25em 0; line-height:1.4em; <!--otherwise lists can appear to form continuous whole--> |oddstyle = background:#f7f7f7; |evenstyle = background:transparent; |groupstyle = text-align:center; |image = [[File:Cupertinologo2.svg|150px]] |state = collapsed |group1 = Projects |list1 = [[Cupertino Alliance Factbook]] {{*}} [[List of CESE election graphics|Election graphics]] {{*}} [https://docs.google.com/document/d/1fxy1y3kNeA7aItbShKTt87vkyXMSwEkOp3dAFiidAZ0/edit?usp=sharing Edinburgh] |group2 = Documents |list2 = [[Charter of the Cupertino Alliance]] {{*}} ''[[Regional Sessions Act]]'' |group3 = People |list3 = {{navbox|child |group1 = Founders |list1 = [[Jayden Lycon]] {{*}} [[William Efton]] |group2 = Founding members |list2 = [[Otto Gillespie Birch]] {{*}} [[Leon Montan]] {{*}} [[Nicolás Millán]]
Then end the Navbox subgroup with an }}
{{Navbox |name = CupertinoAllianceGuideNavbarExample |title = [[File:CupertinoPan.svg|x12px|border|link=]] [[Cupertino Alliance]] |liststyle = padding:0.25em 0; line-height:1.4em; <!--otherwise lists can appear to form continuous whole--> |oddstyle = background:#f7f7f7; |evenstyle = background:transparent; |groupstyle = text-align:center; |image = [[File:Cupertinologo2.svg|150px]] |state = collapsed |group1 = Projects |list1 = [[Cupertino Alliance Factbook]] {{*}} [[List of CESE election graphics|Election graphics]] {{*}} [https://docs.google.com/document/d/1fxy1y3kNeA7aItbShKTt87vkyXMSwEkOp3dAFiidAZ0/edit?usp=sharing Edinburgh] |group2 = Documents |list2 = [[Charter of the Cupertino Alliance]] {{*}} ''[[Regional Sessions Act]]'' |group3 = People |list3 = {{navbox|child |group1 = Founders |list1 = [[Jayden Lycon]] {{*}} [[William Efton]] |group2 = Founding members |list2 = [[Otto Gillespie Birch]] {{*}} [[Leon Montan]] {{*}} [[Nicolás Millán]] }}
If we want to add additional groups/lists, continue from |group3 =
. Keep the }}
as we are not ending Template:Navbox yet.
{{Navbox |name = CupertinoAllianceGuideNavbarExample |title = [[File:CupertinoPan.svg|x12px|border|link=]] [[Cupertino Alliance]] |liststyle = padding:0.25em 0; line-height:1.4em; <!--otherwise lists can appear to form continuous whole--> |oddstyle = background:#f7f7f7; |evenstyle = background:transparent; |groupstyle = text-align:center; |image = [[File:Cupertinologo2.svg|150px]] |state = collapsed |group1 = Projects |list1 = [[Cupertino Alliance Factbook]] {{*}} [[List of CESE election graphics|Election graphics]] {{*}} [https://docs.google.com/document/d/1fxy1y3kNeA7aItbShKTt87vkyXMSwEkOp3dAFiidAZ0/edit?usp=sharing Edinburgh] |group2 = Documents |list2 = [[Charter of the Cupertino Alliance]] {{*}} ''[[Regional Sessions Act]]'' |group3 = People |list3 = {{navbox|child |group1 = Founders |list1 = [[Jayden Lycon]] {{*}} [[William Efton]] |group2 = Founding members |list2 = [[Otto Gillespie Birch]] {{*}} [[Leon Montan]] {{*}} [[Nicolás Millán]] }} |group4 = Capital |list4 = [[Point Cupertino]]
Once we are done, end it with another }}
.
{{Navbox |name = CupertinoAllianceGuideNavbarExample |title = [[File:CupertinoPan.svg|x12px|border|link=]] [[Cupertino Alliance]] |liststyle = padding:0.25em 0; line-height:1.4em; <!--otherwise lists can appear to form continuous whole--> |oddstyle = background:#f7f7f7; |evenstyle = background:transparent; |groupstyle = text-align:center; |image = [[File:Cupertinologo2.svg|150px]] |state = collapsed |group1 = Projects |list1 = [[Cupertino Alliance Factbook]] {{*}} [[List of CESE election graphics|Election graphics]] {{*}} [https://docs.google.com/document/d/1fxy1y3kNeA7aItbShKTt87vkyXMSwEkOp3dAFiidAZ0/edit?usp=sharing Edinburgh] |group2 = Documents |list2 = [[Charter of the Cupertino Alliance]] {{*}} ''[[Regional Sessions Act]]'' |group3 = People |list3 = {{navbox|child |group1 = Founders |list1 = [[Jayden Lycon]] {{*}} [[William Efton]] |group2 = Founding members |list2 = [[Otto Gillespie Birch]] {{*}} [[Leon Montan]] {{*}} [[Nicolás Millán]] }} |group4 = Capital |list4 = [[Point Cupertino]] }}
Naming the template Template:CupertinoAllianceGuideNavbarExample, it should look like:
{{CupertinoAllianceGuideNavbarExample}}
Navbar templates should always be placed at the bottom of the page.
Creating alert templates
These are the most common types of alert templates:
- Template:Ambox (article message box)
- Template:Mbox (multi-namespace messagebox- this auto-detects what page the template is in)
Creating alert templates using amboxes
Start with adding the Ambox template.
{{Ambox
Then, specify what type the ambox is. This will affect the colour of the ambox.
From w:Template:Ambox
We want orange, so we will use | type = content
{{ambox | type = content
Let's add an image. This image will appear on the left side of the ambox. Make it small.
{{ambox | type = content | image = [[File:Cupertinologo2.svg|40px]]
Let's add text.
{{ambox | type = content | image = [[File:Cupertinologo2.svg|40px]] | text = This article is classed as an '''A class''' article under the [[Cupertino Alliance|Edinburgh System]]. }}
Like text templates, we can add additional parameters.
{{ambox | type = content | image = [[File:Cupertinologo2.svg|40px]] | text = This article is classed as an '''A class''' article under the [[Cupertino Alliance|Edinburgh System]]. {{#if:{{{reason|}}}|The reason for the rating given is: {{{reason|}}}.}} }}
Naming our template Template:CupertinoGuideAmboxExample, it should look like:
This article is classed as an A class article under the Edinburgh System. |
{{CupertinoGuideAmboxExample}}
... and with everything:
This article is classed as an A class article under the Edinburgh System. The reason for the rating given is: grammar is really great and lots of photos. |
{{CupertinoGuideAmboxExample |reason = grammar is really great and lots of photos}}
Creating alert templates using mboxes
Start with adding the Mbox template.
{{Mbox
Next, specify what type of mbox is used. There are various types:
Let's do |type=content
{{Mbox |type = content
Let's add an image:
{{Mbox |type = content |image = [[File:Cupertinologo2.svg|40px]]
... and some text and end it the template.
{{Mbox |type = content |image = [[File:Cupertinologo2.svg|40px]] |text= This article is classed as an '''A class''' article under the [[Cupertino Alliance|Edinburgh System]]. {{#if:{{{reason|}}}|The reason for the rating given is: {{{reason|}}}.}} }}
And we are done. Naming our template Template:CupertinoGuideMboxExample, it should look like
This article is classed as an A class article under the Edinburgh System. |
{{CupertinoGuideMboxExample}}
... and with everything:
This article is classed as an A class article under the Edinburgh System. The reason for the rating given is: grammar is really great and lots of photos. |
{{CupertinoGuideMboxExample |reason = grammar is really great and lots of photos}}
Creating in-text templates
In-text templates rely on this text:
<sup><nowiki>[[[LINK]]]</sup></nowiki>
Simply change the link according to your needs:
<sup><nowiki>[[[Cupertino Alliance]]]</sup></nowiki>
Naming our template Template:CupertinoAllianceIntext, it would look like:
{{CupertinoAllianceIntext}}
Additionally, if we want to link to a Wikipedia page and make it italicized, use this text:
<sup><nowiki>[''[[w:Westminster system|Westminster system]]'']</sup></nowiki>
Naming our template Template:CupertinoAllianceIntext two, it would look like:
{{CupertinoAllianceIntext two}}
Related page templates rely on this text:
:''{{rellink|extraclasses=boilerplate seealso|{{{altphrase|<TEXT>}}}: {{#if:{{{1<includeonly>|</includeonly>}}} |<!--then:-->[[:{{{1}}}{{#if:{{{label 1|{{{l1|}}}}}}|{{!}}{{{label 1|{{{l1}}}}}}}}]] |<!--else:-->'''Error: [[Template:|Template must be given at least one article name]]''' }}{{#if:{{{2|}}}|{{#if:{{{3|}}}|, | and }} [[:{{{2}}}{{#if:{{{label 2|{{{l2|}}}}}}|{{!}}{{{label 2|{{{l2}}}}}}}}]] }}{{#if:{{{3|}}}|{{#if:{{{4|}}}|, |, and }} [[:{{{3}}}{{#if:{{{label 3|{{{l3|}}}}}}|{{!}}{{{label 3|{{{l3}}}}}}}}]] }}{{#if:{{{4|}}}|{{#if:{{{5|}}}|, |, and }} [[:{{{4}}}{{#if:{{{label 4|{{{l4|}}}}}}|{{!}}{{{label 4|{{{l4}}}}}}}}]] }}{{#if:{{{5|}}}|{{#if:{{{6|}}}|, |, and }} [[:{{{5}}}{{#if:{{{label 5|{{{l5|}}}}}}|{{!}}{{{label 5|{{{l5}}}}}}}}]] }}{{#if:{{{6|}}}|{{#if:{{{7|}}}|, |, and }} [[:{{{6}}}{{#if:{{{label 6|{{{l6|}}}}}}|{{!}}{{{label 6|{{{l6}}}}}}}}]] }}{{#if:{{{7|}}}|{{#if:{{{8|}}}|, |, and }} [[:{{{7}}}{{#if:{{{label 7|{{{l7|}}}}}}|{{!}}{{{label 7|{{{l7}}}}}}}}]] }}{{#if:{{{8|}}}|{{#if:{{{9|}}}|, |, and }} [[:{{{8}}}{{#if:{{{label 8|{{{l8|}}}}}}|{{!}}{{{label 8|{{{l8}}}}}}}}]] }}{{#if:{{{9|}}}|{{#if:{{{10|}}}|, |, and }} [[:{{{9}}}{{#if:{{{label 9|{{{l9|}}}}}}|{{!}}{{{label 9|{{{l9}}}}}}}}]] }}{{#if:{{{10|}}}|{{#if:{{{11|}}}|, |, and }} [[:{{{10}}}{{#if:{{{label 10|{{{l10|}}}}}}|{{!}}{{{label 10|{{{l10}}}}}}}}]] }}{{#if:{{{11|}}}|{{#if:{{{12|}}}|, |, and }} [[:{{{11}}}{{#if:{{{label 11|{{{l11|}}}}}}|{{!}}{{{label 11|{{{l11}}}}}}}}]] }}{{#if:{{{12|}}}|{{#if:{{{13|}}}|, |, and }} [[:{{{12}}}{{#if:{{{label 12|{{{l12|}}}}}}|{{!}}{{{label 12|{{{l12}}}}}}}}]] }}{{#if:{{{13|}}}|{{#if:{{{14|}}}|, |, and }} [[:{{{13}}}{{#if:{{{label 13|{{{l13|}}}}}}|{{!}}{{{label 13|{{{l13}}}}}}}}]] }}{{#if:{{{14|}}}|{{#if:{{{15|}}}|, |, and }} [[:{{{14}}}{{#if:{{{label 14|{{{l14|}}}}}}|{{!}}{{{label 14|{{{l14}}}}}}}}]] }}{{#if:{{{15|}}}|, and [[:{{{15}}}{{#if:{{{label 15|{{{l15|}}} }}}|{{!}}{{{label 15|{{{l15|}}} }}} }}]] }}{{#if:{{{16|}}}| — '''<br/>Error: [[Template|Too many links specified (maximum is 15)]]''' }}}}''
Change <TEXT>
on <TEXT>
and save it. If we want "Additional pages" to appear, use the text below:
:''{{rellink|extraclasses=boilerplate seealso|{{{altphrase|Additional pages}}}: {{#if:{{{1<includeonly>|</includeonly>}}} |<!--then:-->[[:{{{1}}}{{#if:{{{label 1|{{{l1|}}}}}}|{{!}}{{{label 1|{{{l1}}}}}}}}]] |<!--else:-->'''Error: [[Template:|Template must be given at least one article name]]''' }}{{#if:{{{2|}}}|{{#if:{{{3|}}}|, | and }} [[:{{{2}}}{{#if:{{{label 2|{{{l2|}}}}}}|{{!}}{{{label 2|{{{l2}}}}}}}}]] }}{{#if:{{{3|}}}|{{#if:{{{4|}}}|, |, and }} [[:{{{3}}}{{#if:{{{label 3|{{{l3|}}}}}}|{{!}}{{{label 3|{{{l3}}}}}}}}]] }}{{#if:{{{4|}}}|{{#if:{{{5|}}}|, |, and }} [[:{{{4}}}{{#if:{{{label 4|{{{l4|}}}}}}|{{!}}{{{label 4|{{{l4}}}}}}}}]] }}{{#if:{{{5|}}}|{{#if:{{{6|}}}|, |, and }} [[:{{{5}}}{{#if:{{{label 5|{{{l5|}}}}}}|{{!}}{{{label 5|{{{l5}}}}}}}}]] }}{{#if:{{{6|}}}|{{#if:{{{7|}}}|, |, and }} [[:{{{6}}}{{#if:{{{label 6|{{{l6|}}}}}}|{{!}}{{{label 6|{{{l6}}}}}}}}]] }}{{#if:{{{7|}}}|{{#if:{{{8|}}}|, |, and }} [[:{{{7}}}{{#if:{{{label 7|{{{l7|}}}}}}|{{!}}{{{label 7|{{{l7}}}}}}}}]] }}{{#if:{{{8|}}}|{{#if:{{{9|}}}|, |, and }} [[:{{{8}}}{{#if:{{{label 8|{{{l8|}}}}}}|{{!}}{{{label 8|{{{l8}}}}}}}}]] }}{{#if:{{{9|}}}|{{#if:{{{10|}}}|, |, and }} [[:{{{9}}}{{#if:{{{label 9|{{{l9|}}}}}}|{{!}}{{{label 9|{{{l9}}}}}}}}]] }}{{#if:{{{10|}}}|{{#if:{{{11|}}}|, |, and }} [[:{{{10}}}{{#if:{{{label 10|{{{l10|}}}}}}|{{!}}{{{label 10|{{{l10}}}}}}}}]] }}{{#if:{{{11|}}}|{{#if:{{{12|}}}|, |, and }} [[:{{{11}}}{{#if:{{{label 11|{{{l11|}}}}}}|{{!}}{{{label 11|{{{l11}}}}}}}}]] }}{{#if:{{{12|}}}|{{#if:{{{13|}}}|, |, and }} [[:{{{12}}}{{#if:{{{label 12|{{{l12|}}}}}}|{{!}}{{{label 12|{{{l12}}}}}}}}]] }}{{#if:{{{13|}}}|{{#if:{{{14|}}}|, |, and }} [[:{{{13}}}{{#if:{{{label 13|{{{l13|}}}}}}|{{!}}{{{label 13|{{{l13}}}}}}}}]] }}{{#if:{{{14|}}}|{{#if:{{{15|}}}|, |, and }} [[:{{{14}}}{{#if:{{{label 14|{{{l14|}}}}}}|{{!}}{{{label 14|{{{l14}}}}}}}}]] }}{{#if:{{{15|}}}|, and [[:{{{15}}}{{#if:{{{label 15|{{{l15|}}} }}}|{{!}}{{{label 15|{{{l15|}}} }}} }}]] }}{{#if:{{{16|}}}| — '''<br/>Error: [[Template|Too many links specified (maximum is 15)]]''' }}}}''
If we save it as Template:CupertinoGuideRelatedPageExample, it should look like:
- Additional pages: Error: [[Template:|Template must be given at least one article name]]
{{CupertinoGuideRelatedPageExample}}
An error appeared since we needed to add a page. If we direct it to the page Cupertino Alliance, it will look like that:
- Additional pages: Cupertino Alliance
{{CupertinoGuideRelatedPageExample|Cupertino Alliance}}
If we want to add multiple pages, it should look like:
- Additional pages: Cupertino Alliance and Jayden Lycon
{{CupertinoGuideRelatedPageExample|Cupertino Alliance|Jayden Lycon}}
Adding documentation and categories in templates
Templates can have documentation and categories, placed at the bottom of the page. These won't show when you use it, however will show on the template's page. Categories and documentation are mostly optional, but generally recommended if the template is popular. To add documentation, go to the bottom of the page, and put the text:
<noinclude> {{documentation}} </noinclude>
If we want to add categories, include them between the <noinclude>
tags, like:
<noinclude> {{documentation}} [[Category: Cupertino Alliance]] </noinclude>
To go to your documentation page, go to Template:<name>/doc. For example, Template:CupertinoAllianceIntext two's documentation page is located at Template:CupertinoAllianceIntext two/doc. A documentation page should include an example of the template in use, a blank example of the template, and describe the template's purpose. The documentation text for the aforementioned template is:
==Purpose== To mark sentences to ''[[w:Westminster system|Westminster system]]''. ==Example== Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed odio erat, tristique non vulputate in, porttitor at justo. Aliquam interdum libero eu mauris mollis laoreet.{{CupertinoAllianceIntext two|Cupertino Alliance}} ==Blank example== <pre>{{CupertinoAllianceIntext two|<page>|<page 2>}}</ pre>
Due to MediaWiki's markup system, remove the space in </ pre>
to </pre>
. It should look like:
Assignment
|
---|
Completion of this assignment will be required to attain a barnstar and certificate. Feel free to complete it if you are not interested in attaining it, but if you are not interested in it this is optional.
Make two templates:
|