More actions
m Djavin novienta moved page Templates to UniWiki:Templates |
Added section describing the layout of template pages. |
||
| Line 5: | Line 5: | ||
== Creating and editing templates == | == Creating and editing templates == | ||
Anyone can create or edit templates; it works just like editing pages! More advanced templates can take advantage of some programming capabilities, which can look daunting at first glance. Fortunately, Wikipedia has an excellent page on [https://en.wikipedia.org/wiki/Help:Template getting started with templates], which covers both basic and advanced templates. | Anyone can create or edit templates; it works just like editing pages! More advanced templates can take advantage of some programming capabilities, which can look daunting at first glance. Fortunately, Wikipedia has an excellent page on [https://en.wikipedia.org/wiki/Help:Template getting started with templates], which covers both basic and advanced templates. | ||
=== Template pages === | |||
All templates should consist of two pages: the main template page (<code>Template:<template name></code>) and the template's [[#Template documentation|documentation page]] (<code>Template:<template name>/doc</code>). | |||
A template's main page should consist only of the template itself (sometimes wrapped in {{tag|includeonly}} tags) and the {{tl|Documentation}} template wrapped in {{tag|noinclude}} tags: | |||
{{code|<nowiki><noinclude>{{documentation}}</noinclude></nowiki>}} | |||
For templates that generate a misleading edit link on pages in which they are included, it may also be appropriate to include a comment alerting would-be editors that they are in danger of editing the template itself, rather than the template call inside the containing article. | |||
Care should be taken to avoid any whitespace between <code></includeonly></code> and <code><nowiki><noinclude></nowiki></code>, as transclusion does not ignore whitespace and unnecessary whitespace may interfere with template functions. | |||
All categorization should be placed on the [[#Template documentation|template documentation]] page. | |||
=== Naming templates === | === Naming templates === | ||