Draft:Creating templates
| This article is incomplete. Please feel free to edit this article to add missing information and complete it. |
This is a tutorial on how templates are created. To create a template, create a page in the Template namespace.
Basics
Whatever wikitext you type in a template gets transferred to pages that use the templates. Before finalizing a revision on template space, you should think of how it looks on mainspace.
Parameters
Parameters can be used by typing {{{parameternamehere}}}, with "parameternamehere" replacing the real paramter name. To make a default for the parameter, put a vertical bar (|) followed by the default.
Tags
noinclude and includeonly
Wikitext in <noinclude> tags do not transfer to pages that use them.
Wikitext in <includeonly> tags only appear on pages that use the template.
If statements
{{#if:}} templates are not really templates. They check if a parameter has a value. If the result is true, then put it in the first "parameter". The wikitext that shows up if the result is false should go in the second parameter.
Template data
Template data is what users will see in the visual editor when editing the template's parameters.
Visual editor
When editing template data directly, you are just editing the JSON in the <templatedata> tags, which is basically a lot of advanced text with a few special characters.
There is another way to edit template data: with MediaWiki's template data editor. To use it, click the "Edit template data" button on the website version of Bulbapedia. The website version of Bulbapedia can be accessed by clicking "Desktop" at the bottom of the website.
Languages
You can add languages to your template if you are fluent in two languages. This makes Bulbapedia accessible for everyone.
Description
This will be some info about the template.
Wikitext formatting
You can choose the recommended format to use the template, or customize your own format.
Parameters
If you already have parameters typed into the template wikitext, the editor will show a button to add those parameters, or if you have no parameters typed in, you can click the "add parameter" button at the bottom-left corner of the editor window. Then, you can edit each parameter individually.
| Navigation | Navigation • Search • Tracking changes • Logging in • Watchlist |
|---|---|
| Editing | Editing pages • VisualEditor • Wikicode (Tables) • Images (Media Viewer) • Talk pages • Categories • Subpages • Cheatsheet • Stubs • Epicodes |
| Advanced | Autoconfirmed users • Starting a new page • Moving (renaming) a page • Disambiguation • Merging pages • Splitting pages • Deleting pages • References • Special pages |
| Templates | Using templates (Link templates • Color templates) • Creating templates (Magic words • TemplateStyles • TemplateData) • Lua (Crash course) |
| Customization | Preferences • Skins • Custom CSS • User page (Usertags) • Signatures |
| Archives | FAQ • Uploading images • Tagging images • Manual of style |
| Introduction • FAQ • Editor's Hub | |