BattleTechWiki:Template doc page pattern

Essay.png BattleTechWiki Essay
This essay contains the advice or opinions of one or more BattleTechWiki Editors regarding interacting on the wiki. Essays may represent widespread norms or minority viewpoints. Consider these views with discretion. Consider discussing potential changes on the talk page first.

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?[edit]

Editors generally like to have a usage description of the template right at the template page (example: template:disambig). 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 BattleTechWiki: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, it's pre-expanded size gets multiplied by however many bytes its size needs. So there are conflicting needs. (see BattleTechWiki:Template limits).

This How to page sets forth a strategy and technique that satisfies both the human needs to refresh their memory, the need for documentation (especially for the newer editors still struggling with the rather steep learning curve of wiki usage) and has the added benefit of building pages faster and helps to prevent the server from being inundated with work and slowing it down.

In sum, 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 cake and eat it too.

The solution also has two appreciable spin-off benefits

  1. 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.
  2. Key protected templates that are fully matured can be edited for documentation adds, clarity, categories, et. al. without bothering the main utility.

How-to do it[edit]

For a template with the name Template:X, create a subpage with the name Template:X/doc and copy/paste the following WikiML into that page:

<includeonly>{{template doc page transcluded}}</includeonly><noinclude>{{template doc page viewed directly}}</noinclude>




Insert the documentation, categories and interwikis as indicated by the respective comment lines (see above).

In the page for template X, append:

<!-- Add cats and interwikis to the /doc subpage, not here! -->

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.


  • 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 heavily used templates, this saves phenomenal amounts of bandwidth.
  • 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.


  • 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." [1]


See also[edit]