Help:Template Documentation: Difference between revisions
No edit summary |
No edit summary |
||
Line 6: | Line 6: | ||
Documentation for users, together with the template's categories and interwiki links, is normally placed after the template code, inside "noinclude" tags. It is normally necessary to put the opening "noinclude" tag immediately after the end of the code, with no intervening spaces or newlines, to avoid transcluding unwanted whitespace. | Documentation for users, together with the template's categories and interwiki links, is normally placed after the template code, inside "noinclude" tags. It is normally necessary to put the opening "noinclude" tag immediately after the end of the code, with no intervening spaces or newlines, to avoid transcluding unwanted whitespace. | ||
In the case of complex templates, the documentation (together with categories and wikilinks) is often kept on a separate [[:Template: Documentation subpage|subpage]] of the template page (named "Template:XXX/doc"). This also applies to many [[ | In the case of complex templates, the documentation (together with categories and wikilinks) is often kept on a separate [[:Template: Documentation subpage|subpage]] of the template page (named "Template:XXX/doc"). This also applies to many [[:Template:Pp-template|protected]] templates (to allow the information to be edited by non-administrators). This is achieved by placing the {{tl|Documentation}} template after the main template code (within "noinclude" tags). If the "/doc" subpage does not exist, a link will then appear enabling it to be created. | ||
Some templates contain category definitions in their transcluded code, i.e. they are intended to place the target pages in particular categories. This is often done with maintenance categories (placing articles into ordinary content categories in this way is discouraged). When doing this, it may be necessary to use "includeonly" tags to keep the template itself out of the category. The template should also be designed to suppress categorization in the case of demonstration uses | Some templates contain category definitions in their transcluded code, i.e. they are intended to place the target pages in particular categories. This is often done with maintenance categories (placing articles into ordinary content categories in this way is discouraged). When doing this, it may be necessary to use "includeonly" tags to keep the template itself out of the category. The template should also be designed to suppress categorization in the case of demonstration uses |
Revision as of 20:54, 29 December 2012
This article is a fledgling. Help BoyWiki grow by expanding it |
Documentation and categories
Categorizing your template and documenting its proper usage will make it easier for other editors to find and use.
Documentation for users, together with the template's categories and interwiki links, is normally placed after the template code, inside "noinclude" tags. It is normally necessary to put the opening "noinclude" tag immediately after the end of the code, with no intervening spaces or newlines, to avoid transcluding unwanted whitespace.
In the case of complex templates, the documentation (together with categories and wikilinks) is often kept on a separate subpage of the template page (named "Template:XXX/doc"). This also applies to many protected templates (to allow the information to be edited by non-administrators). This is achieved by placing the {{Documentation}} template after the main template code (within "noinclude" tags). If the "/doc" subpage does not exist, a link will then appear enabling it to be created.
Some templates contain category definitions in their transcluded code, i.e. they are intended to place the target pages in particular categories. This is often done with maintenance categories (placing articles into ordinary content categories in this way is discouraged). When doing this, it may be necessary to use "includeonly" tags to keep the template itself out of the category. The template should also be designed to suppress categorization in the case of demonstration uses