User:Tiddlywinks/Template guidelines

These are guidelines to remember when making and editing templates. We have developed these guidelines over time in response to challenges we've had, so we currently consider them best practice. A template that does not follow these may or may not be a "problem", but you should try to remember these guidelines generally, and if a page is having problems with templates, these guidelines are a good guide to think about how to make improvements.

Parser functions

Try to be sparing with parser functions (basically, any call that starts with #). Too many parser calls on a page can make it hard to update. So if you particularly expect your template to be called many times on the same page, or to be used on pages with many other templates, you should try to limit the parser calls as much as possible.

Nesting templates

Avoid calling big templates from within other templates. This includes passing big templates as part of a parameter. Calling a template from another more or less counts double towards template limits because expansion is weird.

This is a large reason why we structure many of our templates as header, body/rows, footer constructs. While passing a bunch of rows to a container template that automatically wraps them in both the header and footer may seem a little simpler, it can be far more resource-intense.

This doesn't mean you can't call any templates: small templates like {{p}} and such are usually fine.

High-use templates

High-use templates should only be edited in down times for our server traffic. Generally this means "late" in the US timeframe: say, roughly 0600 UTC to 1100 UTC.

Most high-use templates are protected, but it may be that some are not (or you may have the power to edit protected pages), so if a template's "What links here" shows hundreds of pages, consider carefully whether "now" is the right time.