Jump to content

VassarWiki:Templates: Difference between revisions

From VassarWiki
created page
 
without line breaks
Line 10: Line 10:


=== Documentation ===
=== Documentation ===
To make it easy for contributors to use your template, all templates should have documentation. Write "<nowiki><noinclude>{{Documentation}}</nowiki><nowiki></noinclude></nowiki>" at the end of your template―this will transclude the information from your template's documentation page (located at "Template:Example/doc") onto the Template page, but not when using your template on another page.  
To make it easy for contributors to use your template, all templates should have documentation.
 
Without any line breaks or spaces, write "<nowiki><noinclude>{{Documentation}}</nowiki><nowiki></noinclude></nowiki>" at the end of your template―this will transclude the information from your template's documentation page (located at "Template:Example/doc") onto the Template page, but not when using your template on another page.  


Template documentation should have at least two parts:
Template documentation should have at least two parts:
Line 21: Line 23:


* [[Template:Userbox]]: A meta-template that can be built upon to easily communicate about yourself on your user page.
* [[Template:Userbox]]: A meta-template that can be built upon to easily communicate about yourself on your user page.
* [[Template:See also]] & [[Template:Main article]]: Notes at the top of sections to display important links
* [[Template:See also]] & [[Template:Main article]]: Notes at the top of pages or sections to display important links


== See also ==
== See also ==


* https://www.mediawiki.org/wiki/Help:Templates
* https://www.mediawiki.org/wiki/Help:Templates

Revision as of 21:09, 9 April 2026

Templates are pages designed for inclusion in other pages.

Using a template

To use a template in the Visual Editor, click "Insert" then "Template", or type two left curly brackets {{. From here, you can search for the template you need, and save commonly used templates.

In the Source Editor, you will have to type the syntax manually. Take a look at the desired template's documentation, where there may be example syntax that you can adapt.

Making a template

Anyone can make a template! Just create a page with the prefix "Template:" and insert the text and code you wish to be transferred to another page. Templates can be newly written or, to save duplicating work already done, exported from another wiki like Wikipedia, and then imported here.

Documentation

To make it easy for contributors to use your template, all templates should have documentation.

Without any line breaks or spaces, write "<noinclude>{{Documentation}}</noinclude>" at the end of your template―this will transclude the information from your template's documentation page (located at "Template:Example/doc") onto the Template page, but not when using your template on another page.

Template documentation should have at least two parts:

  1. Template data: a short description of the template and information about the template's variables. Provide template data by clicking the "Edit template data" button when editing the documentation page.
  2. Example usage: In an "Examples" section, provide both example syntax (between <pre> </pre>) and an example template displayed (the same syntax but without <pre> </pre>).

Notable templates

See also