Editing Help:Templates

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 7: Line 7:
 
}}
 
}}
 
<br/>
 
<br/>
 
+
{{Infobox
At their most basic, '''templates''' are basically just wiki pages whose content may be pulled into other pages. In other words, all the content you see when viewing a page may not actually be in the page source. Some or even all of it may be in templates.
 
 
 
Two very common types of templates are shown here as examples:
 
* To the right, there is an example of an "infobox" template. Nearly every wiki provides at least one of these.
 
* Below, there is an example of a navigation template called a "navbox" - typically used at the bottom of pages.
 
{{Navbar example}}
 
<!-- Infobox should be higher on the page, but the navbar mucks it up -->
 
{{Infobox example
 
 
| name    = Phoebe
 
| name    = Phoebe
 
| image    = Phoebe friendly.png
 
| image    = Phoebe friendly.png
Line 25: Line 17:
 
| ID      = Phoebe_ID
 
| ID      = Phoebe_ID
 
}}
 
}}
 +
 +
At their most basic, '''templates''' are basically just wiki pages whose content may be pulled into other pages. In other words, all the content you see when viewing a page may not actually be in the page source. Some or even all of it may be in templates.
 +
 +
Two very common types of templates are shown here as examples:
 +
* To the right, there is an example of an "infobox" template. Nearly every wiki provides at least one of these.
 +
* Below, there is an example of a navigation template called a "navbox" - typically used at the bottom of pages.
 +
{{Navbar example}}
  
 
Speaking generally, a template is any wiki page whose content is designed to be [[wikipedia:Wikipedia:Transclusion|transcluded]] (embedded) inside other pages. Templates follow a convention that the name is prefixed with <code>Template:</code>, assigning it to that [[wikipedia:Wikipedia:Namespace|namespace]].
 
Speaking generally, a template is any wiki page whose content is designed to be [[wikipedia:Wikipedia:Transclusion|transcluded]] (embedded) inside other pages. Templates follow a convention that the name is prefixed with <code>Template:</code>, assigning it to that [[wikipedia:Wikipedia:Namespace|namespace]].
Line 35: Line 34:
 
Or perhaps something more complex like this:
 
Or perhaps something more complex like this:
 
   
 
   
  <nowiki>{{Infobox example
+
  <nowiki>{{Infobox
 
| name    = Phoebe
 
| name    = Phoebe
 
| image    = Phoebe friendly.png
 
| image    = Phoebe friendly.png
Line 47: Line 46:
 
</nowiki>
 
</nowiki>
  
These are examples of templates being used on these wiki pages. The first is using <nowiki>[[Template:navbar example]]</nowiki>, the second is using <nowiki>[[Template:Infobox example]]</nowiki>. The double curly brackets, <code>{{</code> and <code>}}</code> usually mean that a template is being used there, but unfortunately, double curly brackets also have other uses in wikitext, which can cause some confusion.
+
These are examples of templates being used on these wiki pages. The first is using <nowiki>[[Template:navbar example]]</nowiki>, the second is using <nowiki>[[Template:Infobox]]</nowiki>. The double curly brackets, <code>{{</code> and <code>}}</code> usually mean that a template is being used there, but unfortunately, double curly brackets also have other uses in wikitext, which can cause some confusion.
  
 
=== How to tell if it's a template ===
 
=== How to tell if it's a template ===
 
Let's look at our examples above again.
 
Let's look at our examples above again.
  
  <nowiki>{{Infobox example
+
  <nowiki>{{Infobox
 
| name    = Phoebe
 
| name    = Phoebe
 
| image    = Phoebe friendly.png
 
| image    = Phoebe friendly.png
Line 64: Line 63:
 
</nowiki>
 
</nowiki>
  
In this case, we have a definite clue because the first thing after the name other than just space is a pipe character: (<code>|</code>). This is definitely a template. If it were a colon instead, (<code>:</code>), then it would not be a template, but some kind of [[Wikipedia:Help:Magic words|magic word]].
+
In this case, we have a definite clue because the first thing after the name other than just space is a pipe character: (<code>|</code>). This is definitely a template. If it were a colon instead, (<code>:</code>), then it would not be a template, but some kind of [[Help:Magic words|magic word]].
  
 
  <nowiki>{{navbar example}}</nowiki>
 
  <nowiki>{{navbar example}}</nowiki>
Line 71: Line 70:
 
* One clue that it is a template is that it ''isn't'' in all capital letters. Virtually all magic words that don't require a colon are typed in all caps.
 
* One clue that it is a template is that it ''isn't'' in all capital letters. Virtually all magic words that don't require a colon are typed in all caps.
 
* To be sure, when editing a page, you should see "Templates used on this page" at the bottom of the screen under the "{{int:savearticle}}" and other buttons. If it's listed there, it's definitely a template.
 
* To be sure, when editing a page, you should see "Templates used on this page" at the bottom of the screen under the "{{int:savearticle}}" and other buttons. If it's listed there, it's definitely a template.
* If it isn't a documented [[Wikipedia:Help:Magic words|magic word]], it's almost certainly a template.
+
* If it isn't a documented [[Help:Magic words|magic word]], it's almost certainly a template.
  
 
== Basic transclusion ==
 
== Basic transclusion ==
Line 95: Line 94:
 
Unfortunately, many templates are not documented. In this case, you can try looking for examples of the template being used on other pages. From the template page, try clicking "What links here" in the "Tools" menu in the sidebar to find other pages where the template is used. If it's not documented, consider writing your own template documentation.
 
Unfortunately, many templates are not documented. In this case, you can try looking for examples of the template being used on other pages. From the template page, try clicking "What links here" in the "Tools" menu in the sidebar to find other pages where the template is used. If it's not documented, consider writing your own template documentation.
  
It can help to understand how to write templates. Once you do, you may be able to figure out a template simply by opening it for editing and looking at its source. However, templates can be very complex and may use advanced wiki features or specific extensions, like any other wiki page. If all else fails, never hesitate to ask for assistance from the [[RimWorld Wiki:Community portal|staff]] or wiki community.
+
It can help to understand how to [[Help:Writing templates|write templates]]. Once you do, you may be able to figure out a template simply by opening it for editing and looking at its source. However, templates can be very complex and may use advanced wiki features or specific extensions, like any other wiki page. If all else fails, never hesitate to ask for assistance from the [[RimWorld Wiki:Community portal|staff]] or wiki community.
  
 
== Alternate ways to use templates ==
 
== Alternate ways to use templates ==

Please note that all contributions to RimWorld Wiki are considered to be released under the CC BY-SA 3.0 (see RimWorld Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)