Revision as of 18:14, 2 February 2007 view sourceFabartus (talk | contribs)Extended confirmed users21,651 edits Add write up on subst method using template Template:interwiki doc page pattern and add NEW Misplaced Pages:Template doc page pattern/doc← Previous edit | Revision as of 18:31, 8 February 2007 view source Ligulem (talk | contribs)Autopatrolled, Pending changes reviewers, Rollbackers28,245 edits rv. This doesn't belong hereNext edit → | ||
Line 1: | Line 1: | ||
{{Shortcut|]<br>]}} | {{Shortcut|]}} | ||
The '''template doc page pattern''' is a method to securely split ] off from template code in a separate page. It enables full protection of template code while retaining the documentation part unprotected, so that everyone can still edit the documentation. | The '''template doc page pattern''' is a method to securely split ] off from template code in a separate page. It enables full protection of template code while retaining the documentation part unprotected, so that everyone can still edit the documentation. | ||
Line 16: | Line 16: | ||
# It minimizes server loading again for widely used templates which occurs when they are updated in the least way, such as when someone adds a foreign language interwiki link. | # It minimizes server loading again for widely used templates which occurs when they are updated in the least way, such as when someone adds a foreign language interwiki link. | ||
# Key protected templates that are fully matured can be edited for documentation adds, clarity, categories, etc. without bothering the main utility. | # Key protected templates that are fully matured can be edited for documentation adds, clarity, categories, etc. without bothering the main utility. | ||
⚫ | == Benefits == | ||
⚫ | * Edits to the X/doc page only propagate to the template display page itself, not to transclusions of X. Pages transcluding X are therefore not dependent on the doc page, so edits to the doc page don't inflate the ] for heavy use templates. | ||
⚫ | * Edits to the documentation can't do any harm to the template itself and to transcluding pages. Vandalism to the doc page doesn't propagate into pages transcluding X. | ||
⚫ | * Everyone can edit the template documentation, even if the template itself is fully protected. Categories and interwikis can be easily added to the X/doc subpage. | ||
== How to do it == | == How to do it == | ||
== The contents of /doc pages == | |||
For a template with the name Template:X, create a subpage with the name Template:X/doc and copy/paste the following wikicode for a start into that page: | For a template with the name Template:X, create a subpage with the name Template:X/doc and copy/paste the following wikicode for a start into that page: | ||
Line 39: | Line 31: | ||
</includeonly></nowiki><br/><nowiki> | </includeonly></nowiki><br/><nowiki> | ||
</nowiki></code> | </nowiki></code> | ||
Insert the documentation, categories and interwikis as indicated by the respective comment lines (see above). | Insert the documentation, categories and interwikis as indicated by the respective comment lines (see above). | ||
===In the page for template X=== | |||
In the page for template X, append after the template code: | In the page for template X, append after the template code: | ||
Line 55: | Line 45: | ||
The template itself can now be fully protected, while its documentation page at ''''X/doc'''' can remain fully unprotected so that everyone can edit the documentation. | The template itself can now be fully protected, while its documentation page at ''''X/doc'''' can remain fully unprotected so that everyone can edit the documentation. | ||
⚫ | == Benefits == | ||
===Alternative method=== | |||
⚫ | * Edits to the X/doc page only propagate to the template display page itself, not to transclusions of X. Pages transcluding X are therefore not dependent on the doc page, so edits to the doc page don't inflate the ] for heavy use templates. | ||
{{interwikitmp-grp}} | |||
⚫ | * Edits to the documentation can't do any harm to the template itself and to transcluding pages. Vandalism to the doc page doesn't propagate into pages transcluding X. | ||
This link shows what you get on a /doc page when you ] method: | |||
⚫ | * Everyone can edit the template documentation, even if the template itself is fully protected. Categories and interwikis can be easily added to the X/doc subpage. | ||
# On your template page, make the below'' 'In the page for template X' ''lines: | |||
## If upgrading an older existing template, especially one being tagged and ported by {{tl|interwikitmp-grp}} (shown at right) it is important that that template be part of the doc page, otherwise changes to it heavily load the server and cause a data-base lockup. {{I2}}(This is in general, the reason to use this method every where for popular or widespread templates, even some as short and sweet in execution code as listed in {{c|Miscellaneous templates}} && {{c|Typing-aid templates}} like ], ], ] and the like. The more popular a template is, the more important it will be to use this /doc method.){{i2}} | |||
## Whether your template is new, or old, take what usage notes and categories pertain to it into your cut buffer. {{i2}} | |||
## Preview — you now have a link to the doc page, so navigate there (you should be in an automatic edit screen), and '''enter <nowiki> {{subst:interwiki doc page pattern}}</nowiki> and save the page. {{i2}} | |||
# {{tl|interwiki doc page pattern}} will now have done most of the work above for you, with some clean-up needs: | |||
## Whether to keep or delete interwikitmp-grp? {{i2}} | |||
## Fix three 'space broken' command words using backspace or delete key. {{i2}} | |||
## Pasting your usage text and categories into the /doc page. {{i2}} | |||
## refactor as needed so things are inbetween the right comment lines. Preview, and save. {{i2}} | |||
# Backspace/back arrow to your unsaved template edit, re-preview. Proof things. Categories, display, etc. {{i2}} | |||
## You can return to the /doc via the edit feature at any time now. {{i2}} | |||
## All looking good? Now save. Done. {{i2}} | |||
== References == | == References == |
Revision as of 18:31, 8 February 2007
Shortcut- ]
The template doc page pattern is a method to securely split template documentation off from template code in a separate page. It enables full protection of template code while retaining the documentation part unprotected, so that everyone can still edit the documentation.
What does it solve?
Wikipedians generally like to have a usage description of the template right at the template page (example: template:cite news). This can be achieved by writing some descriptive text into the template wiki-source inside <noinclude>...</noinclude>. However, this has some drawbacks:
- The text inside <noinclude>...</noinclude> does add to the pre-expand include size, which is limited (see Misplaced Pages:Template limits).
- Some templates are fully protected, because they are transcluded into a lot of pages. Editing the documentation is awkward in this case, because non-sysops must make a request to edit a protected page and a sysop has to do the edit.
- There is an upper limit to both the pre-included and post-expanded sizes of a page. Worse, the more a template is included, its pre-expanded size gets multiplied by however many bytes its size needs. So there are conflicting needs. (see Misplaced Pages:Template limits).
This How to page sets forth a strategy 'and technique' that satisfies both the human needs to refresh their memory, (or most commonly, learn from the first exposure! The 'needs' for documentation, especially for the newer editors still on the many steep wiki learning curves.) and has the added benefit of building pages faster and unloading the servers processing loads. (We all do love to wait for that page to load, soooo much!)
In summation, the dual solution is to place the documentation and usage notes in a documentation template instead of the tool or utility template (which if worded carefully, can usually cover several related tools or utility type templates) that is walled behind a <noinclude>...</noinclude> block that is very short... so easy on the processor and, thus, we get to have our documentation cake and eat it too — faster!
The solution also has two apppreciable spin-off benefits:
- It minimizes server loading again for widely used templates which occurs when they are updated in the least way, such as when someone adds a foreign language interwiki link.
- Key protected templates that are fully matured can be edited for documentation adds, clarity, categories, etc. without bothering the main utility.
How to do it
For a template with the name Template:X, create a subpage with the name Template:X/doc and copy/paste the following wikicode for a start into that page:
<includeonly>{{template doc page transcluded}}</includeonly><noinclude>{{template doc page viewed directly}}</noinclude>
<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE -->
<includeonly>
<!-- ADD CATEGORIES BELOW THIS LINE -->
<!-- ADD INTERWIKIS BELOW THIS LINE -->
</includeonly>
Insert the documentation, categories and interwikis as indicated by the respective comment lines (see above).
In the page for template X, append after the template code:
<noinclude>
{{{{FULLPAGENAME}}/doc}}
<!-- Add cats and interwikis to the /doc subpage, not here! -->
</noinclude>
Attention: Make sure the opening <noinclude> begins on the same line as the last character of the template code (or text), not on a new line. Otherwise, an additional newline will be inserted into pages transcluding X (which is almost never wanted).
The template itself can now be fully protected, while its documentation page at 'X/doc' can remain fully unprotected so that everyone can edit the documentation.
Benefits
- Edits to the X/doc page only propagate to the template display page itself, not to transclusions of X. Pages transcluding X are therefore not dependent on the doc page, so edits to the doc page don't inflate the job queue for heavy use templates.
- Edits to the documentation can't do any harm to the template itself and to transcluding pages. Vandalism to the doc page doesn't propagate into pages transcluding X.
- Everyone can edit the template documentation, even if the template itself is fully protected. Categories and interwikis can be easily added to the X/doc subpage.
References
- Tim Starling wrote: "If the documentation is large or frequently changed, I'd recommend that you move it to a subpage. Then you can transclude it into both the <noinclude> section and the talk page."
Examples
- template:cite web (protected), template:cite web/doc (unprotected)
See also
- <noinclude> and <includeonly>
- Misplaced Pages:High-risk templates
- Template:template doc page transcluded
- Template:template doc page viewed directly