CupertinoGuide/Templates

From MicroWiki, the free micronational encyclopædia
Jump to navigation Jump to search
Cgtransition.png

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.
Please continue using the Cupertino Guide on micronations.wiki until our transition is complete. We hope that these changes can better help you in the future and we hope you have a fantastic day!

Cupertinoguides.png

This page is apart of the Cupertino Guides project, a project by the Cupertino Alliance.

Recommended skill level
Intermediate
Some experience within MicroWiki editing and writing may be required for this lesson.

Templates can be a good way to "spice" up an article. They can be used to add graphical enrichment to an article (like Template:Infobox official 2), repeat the most important information regarding an article (like Template:subst:infobox nation/skin), or add required information to an article (like Template:Citation needed).

Types of templates

There are usually six types of templates:

  • Infobox templates, which usually titled like Template:Infobox <stuff>. For example, Template:subst:infobox nation/skin. These templates utilize an infobox to summarize information in an article.
  • Navbar templates, which use a navbar to link related pages into a bar. These usually do not have a uniform name. Examples include Template:Empire of Austenasia.
  • Alert templates, which display an alert regarding an article. These usually do not have a uniform name. Examples include Template:WIP.
  • In-text templates, which display an alert between the text of an article. These usually do not have a uniform name. Examples include Template:Citation needed.
  • Related page templates, which link to a related article. These usually do not have a uniform name. Examples include Template:Main.
  • Text templates, which are simple templates that just contain text and maybe photos.

This being said, not all templates have to fit in these categories. Templates are just containers of information that can be shared between various wiki pages.

Template name space

Anything which starts with Template: in its name at the start can be used as a template. This is what we call the template namespace. You can not use curly brackets for pages that are not in the template namespace.

Placing an infobox template: source editor

Video
Video by fellow CA delegate Isaiah David covers this topic: https://www.youtube.com/watch?v=7fCuyeXMZPo

Placing a template

To place an infobox template, start with {{, followed by the template name, excluding the template namespace. For example, Template:subst:infobox nation/skin would start as {{subst:infobox nation/skin.

Parameters and values

Most templates have parameters which need to be filled by values. These parameters can vary by template, and usually look like this: |name =. These parameters need to be fulfilled by values, which can include normal text, text under wiki markup, files, or additional templates.

Obamaland

For example, if we use Template:subst:infobox nation/skin, use the parameter |name = and fill the aforementioned parameter with value Obamaland, it should look like this and would have the wiki markup of below:

{{subst:infobox nation/skin
|name = Obamaland}}

Finding parameters

As finding these parameters can be tricky, it is generally recommended just to copy and paste a template that is already being used in another wiki page. Then, paste it back to your page. However, if that doesn't exist, continue with this section.

First, click "Edit Source" for the source editor. This can really only be done on source editor. Then, locate something that says |data =. It usually has {{{head of state|}}} or {{#if:{{{head of state|}}}|{{{head of state|}}}}}</small>}}. It may or may not have its corresponding |label =.

The name that is located {{{here|}}} would be the name of your parameter. For example, in our previous example above ({{{head of state|}}} / {{#if:{{{head of state|}}}|{{{head of state|}}}}}</small>}}), it would be |head of state =. Note that parameters can be in both labels and data.

Obamaland
Government
{{subst:infobox nation/skin
|name = Obamaland
|head of state = President}}

If it isn't appearing (like above), 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|}}} tells us that we need to fulfill |head of state = in order for |hos_name = to appear.

Obamaland
Government
• President
Obama
{{subst:infobox nation/skin
|name = Obamaland
|head of state = President
|hos_name = Obama}}

The syntax may look complex when it is pilled up, but you'll simply have to shuffle through the text for parameters.

Regarding files on some templates

Some infoboxes, like Template:Infobox country, use something like:

{{#invoke:InfoboxImage|InfoboxImage|suppressplaceholder={{main other||no}}|image={{{image_flag|}}}|sizedefault=125px|size={{{flag_width|}}}|maxsize=350|border={{yesno |{{{flag_border|}}}|yes=yes|blank=yes}}|alt={{{alt_flag|}}}|title=Flag of {{{common_name|{{{name|{{{linking_name|{{PAGENAME}}}}}}}}}}}}}

...meaning that you do not have to add [[File: and ]] for some parameters. However, some templates may require you to use [[File: and ]]. Most editors guess and check. For example, for the aforementioned template, do:

{{Infobox country
|name = Cupertinoland
|image_flag = CupertinoPan.svg
}}

...and it would look like:

Cupertinoland
Flag of Cupertinoland
Flag

Closing templates

Templates need to be closed using }}. Templates are usually closed when you're finished, at the end of the template. If you use multiple templates in a wiki, you need to close all of them when you're finished. Consider the following example.

Placing an infobox template: visual editor

Infobox templates can be added using visual editor through these steps:

Placing an navbar template

At the bottom of the article, insert your template. No parameters are usually required for navbar templates. If we want to add the template Template:CupertinoAlliance, it would look like this:

{{CupertinoAlliance}}

For visual editor, follow the format rules above but add the template through Insert > Template.

Placing an alert template

At the start of the article, insert your template. Parameters might be present but a majority of users do not use them. If we want to add the template [[Template:]], it would look like this:

{{WIP}}

...and would look like:

If we want to add certain parameters, it may look like:

{{WIP
|placedby = [[User:Jaydenfromcanada]]
|comment = Random comment here
}}

...and would look like:

For visual editor, follow the format rules above but add the template through Insert > Template.

Placing an in-text template

At the end of a sentence, insert your template without a space. No parameters are usually required for navbar templates. If we want to add the template Template:Citation needed for an uncited sentence, it would look like this:

Almonds are better than peanuts{{citation needed}}.

...and it would look like this:

Almonds are better than peanuts[citation needed].

For visual editor, follow the format rules above but add the template through Insert > Template.

Placing a related page template

Between a paragraph break, or at the start of a sentence, insert the template. Next, add | and insert the page you want to direct to, then end the template. Most templates do not require the [[ you normally need for links. For example,

{{Main|Cupertino Alliance}}

...and it would look like this:

Multiple pages would look like:

{{Main|Cupertino Alliance|Jayden Lycon}}

...and it would look like this:

For visual editor, follow the format rules above but add the template through Insert > Template.

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. This assignment combines "YourFirstArticle" and "Templates".

Make a wiki page relating to MicroWiki (like a micronation or a micronationalist), containing a variety of templates and images. It must contain at least one infobox and be of moderate to good quality.