Templates Wiki

Editing

Template layout

1
  • 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. If you are undoing an edit that is …
Latest revision Your text
Line 1: Line 1:
 
{{tocright}}
 
{{tocright}}
   
This article covers the '''general layout for a standard template page on FANDOM wikis'''.
+
This article covers the '''general layout for a standard template page on Wikia'''.
   
 
==Procedure==
 
==Procedure==
Put the template code on the main page, and put all documentation and categories on a <tt>/doc</tt> subpage.
+
Put the template code on the main page, and put all documentation and categories on a /doc subpage.
   
 
This means that updates to the documentation do not result in large numbers of pointless template updates across the wiki, and the template itself can be protected if necessary (without protecting the documentation).
 
This means that updates to the documentation do not result in large numbers of pointless template updates across the wiki, and the template itself can be protected if necessary (without protecting the documentation).
Line 12: Line 12:
 
:If you want to use a documentation page (<tt>/doc</tt>)
 
:If you want to use a documentation page (<tt>/doc</tt>)
 
<pre>
 
<pre>
<onlyinclude><!-- Template code
+
Template code<includeonly>Any categories to be inserted into articles by the template</includeonly><noinclude>
--><includeonly><!-- Any categories to be inserted into articles by the template
+
{{documentation}}</noinclude>
-->[[Category:Added by template]]</includeonly></onlyinclude>
 
{{documentation}}
 
<!-- After documentation, optionally add any categories to organize the template itself
 
-->[[Category:Templates|{{PAGENAME}}]]
 
 
</pre>
 
</pre>
   
Line 20: Line 20:
 
;Description
 
;Description
 
:This template is used to do something.
 
:This template is used to do something.
 
;Dependencies
 
:<!-- CSS, JS, image or other template dependencies. -->
 
 
 
;Syntax
 
;Syntax
 
:Type <code>{{t|templatename}}</code> somewhere.
 
:Type <code>{{t|templatename}}</code> somewhere.
 
;Parameters
 
* <code>Param1 = </code> what param 1 needs (default: <code>default value </code>)
 
* <code>Param2optional = </code> ''optional'' what param 2 needs
 
 
 
;Sample output
 
;Sample output
 
:<code><nowiki>{{templatename|foo}}</nowiki></code> gives...
 
:<code><nowiki>{{templatename|foo}}</nowiki></code> gives...
Line 38: Line 29:
 
----
 
----
 
;Template
 
;Template
<onlyinclude>Template code<includeonly>
+
<onlyinclude>Template code<includeonly>Any categories to be inserted into articles by the template</includeonly></onlyinclude>
Any categories to be inserted into articles by the template</includeonly></onlyinclude>
+
-Optionally-{{documentation}}
<!-- Optionally -->{{documentation}}
+
Any categories to organize the template itself
<!-- Any categories to organize the template itself -->[[Category:Templates|{{PAGENAME}}]]
 
 
</pre>
 
</pre>
   
Line 53: Line 44:
 
;Description
 
;Description
 
:This template is used to do something.
 
:This template is used to do something.
 
 
;Dependencies
 
;Dependencies
:<!-- CSS, JS, image or other template dependencies. -->
+
* CSS, JS, image or other template dependencies.
 
 
;Syntax
 
;Syntax
 
:Type <code>{{t|templatename}}</code> somewhere.
 
:Type <code>{{t|templatename}}</code> somewhere.
 
;Parameters
 
* <code>Param1 = </code> what param 1 needs (default: <code>default value</code>)
 
* <code>Param2optional = </code> ''optional'' what param 2 needs
 
 
 
;Sample output
 
;Sample output
 
:<code><nowiki>{{templatename|foo}}</nowiki></code> gives...
 
:<code><nowiki>{{templatename|foo}}</nowiki></code> gives...
 
:{{templatename|foo}}
 
:{{templatename|foo}}
   
<includeonly><!-- Any categories to organize the template itself
+
<includeonly>Any categories for the template itself</includeonly><noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>
-->[[Category:Templates|{{PAGENAME}}]]</includeonly><noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>
 
 
</pre>
 
</pre>
   
Line 76: Line 61:
 
Note that the above example also uses the [[Template:T]] template.
 
Note that the above example also uses the [[Template:T]] template.
   
=== Why not use a separate documentation subpage? ===
+
=== Why not use a separate documentation page? ===
 
While using a documentation subpage (<tt>Template:''templatename''/doc</tt>) has become standard practice, it is really only better when the documentation is large or has many examples. For smaller, simpler templates with light documentation needs, including the documentation on the template page itself can be faster and more self-contained. Remember, using a <tt>/doc</tt> subpage for documentation usually implies the need to use the {{t|Documentation}} template which automatically adds a dependency on another template (which ironically, is usually undocumented). Also, the use of categories can be far more confusing when using a transcluded <tt>/doc</tt> subpage in a template page.
 
While using a documentation subpage (<tt>Template:''templatename''/doc</tt>) has become standard practice, it is really only better when the documentation is large or has many examples. For smaller, simpler templates with light documentation needs, including the documentation on the template page itself can be faster and more self-contained. Remember, using a <tt>/doc</tt> subpage for documentation usually implies the need to use the {{t|Documentation}} template which automatically adds a dependency on another template (which ironically, is usually undocumented). Also, the use of categories can be far more confusing when using a transcluded <tt>/doc</tt> subpage in a template page.
   
Line 83: Line 68:
 
*[[Template:Documentation]] - for the documentation box
 
*[[Template:Documentation]] - for the documentation box
 
*[[Template:T]] - to link to the various templates
 
*[[Template:T]] - to link to the various templates
[[ja:ヘルプ:テンプレート/レイアウト]]
 
 
[[Category:Content]]
 
[[Category:Content]]
 
[[Category:Templates| Template layout]]
 
[[Category:Templates| Template layout]]
  Loading editor