OurMed:Substitution

Substitution is the one-time copying of any other page's content into the page currently being edited, instead of transcluding the page (usually ). To substitute, add  after the opening braces (that is,  ).

Also, this page lists templates that should always or should never be substituted except in the OurMed namespace. Automated tools (bots) that do such replacements will never be used on the original template pages.

If you are going to use a bot to substitute templates, please read through the talk page first, as many are under dispute or change status over time, and substitution is permanent.

Definition
The subst: keyword (short for "substitution") is used as a prefix inside template code. It changes the way the software expands the template. Ordinarily, a template will be expanded "on the fly"; that is, the template code on a page calls a separate page every time it is rendered. Although most page views are served from the cache, pages need to be rendered for previews, and rendered again when the page changes. When someone is editing a page with a normal template call, they see the template call. Placing "subst:" inside the curly brackets tells the software to permanently replace the template with the text of the template (i.e., the text that is on the template's article page when the template is added to the page). Therefore becomes , until you save the page. The next editor sees not the template call, but the text of the template when you saved; it does not change even if the template is edited.

Usage
You can subst a template tag by adding "subst:" to a template tag. For example, use instead of.

When this is a major component of an edit, it is strongly suggested that the template be mentioned in the edit summary (for instance, put " ", "subst:test"  or "test1 applied" in your edit summary) so other editors can easily see what you have done.

Additionally, when creating or editing templates that are commonly substituted, adding an HTML comment to the template page helps article editors to see how templates are being used (e.g. ).

Benefits of substitution

 * Templates are often modified or deleted. If a template is boilerplate text, consider whether you want it to vary as the template is modified.  If your answer is "no", substitution is warranted.  An example of this is the welcome template.  The archives of a user's talk page should show the actual welcome message they received, not the current welcome message.
 * If there is a template you would like to modify for a single occasion, but you do not want to modify the template for all the pages that use it, and you do not want to make a new template, you can substitute the template and then with a second edit, make the modifications. For example: a template might be used with all the states of the United States and with the District of Columbia.  The template might be worded correctly for the states, but not for DC.  To fix the wording, you can substitute the template and then fix the wording.
 * Substituting frequently used, but unprotected templates (of which there are few, such as helpme) limits the damage that can be caused by vandalising them. See high-risk templates.
 * Using certain templates hides wikitext from newcomers, which prevents them from learning how to use it. (Of course, there is a "how to edit" link at the bottom of each edit page.)
 * Substituting en masse may speed up the site, though the amount and significance of this is the subject of frequent debate. Every time a page is rendered, the server must get text from a separate page for each template used; while each individual template has little effect, the vast number of templates used on OurMed is one factor affecting server load and article load times.  However, Chief Technical Officer Brion Vibber (who "maintain[s] overall responsibility for all technical functions of the Foundation, including both hardware and software") has said : Policy' should not really concern itself with server load except in the most extreme of cases; keeping things tuned to provide what the user base needs is our job."  (See OurMed:Don't worry about performance.)

Drawbacks of substitution

 * Once a template is substituted, the result is no longer linked to the template, making it hard to find all pages displaying that text (though categories can sometimes relieve this). This problem can easily be worked around by including a link to the template in the template's code or assigning it a z number, specifically for the purpose of tracking its usage.
 * A substituted template will not be updated when the master template is updated.
 * If the template is used to standardize the appearance of something, you probably do not want to do a substitution. An example of this is a table of contents or navigation box.
 * Substituting en masse—editing thousands of articles with bots—slows down the site and wastes server resources unnecessarily.
 * Substitution increases the size of articles in the database and database dumps.
 * A substituted template can add a lot of wiki-code or HTML to the article, harming accessibility for the less technically inclined.
 * Substituting templates prevents newcomers from learning to use templates, and prevents users from finding their documentation.
 * If the template is just being used temporarily, it is usually better not to substitute. Substituted templates are much harder to remove or modify.
 * When a vandalised template is substituted, it is more difficult to repair than regular vandalism because of the lack of links between the template and its incarnations and the lack of updatability.
 * Some meta-templates, such as and ((, do not work if they are substituted.

Templates that should be substituted
This is a list of templates that should always be substituted, organized by namespace. Each list is ordered alphabetically with grouped series.

Article namespace

 * footnotes, Footnotestext—substituting these inserts a commentary only visible in edit mode, with a short explanation of how footnotes work (the first also inserts the tag),
 * sub, sup – but suggest these not subst:ed if used many times on one page, otherwise code likely to become cluttered.

Article talk

 * tmfrom, tmto

User talk namespace
All of the templates listed in Category:User warning templates and Category:Welcome templates, as well as the Template:Shoutbox, should be substituted. This does not apply to templates on the user page.

Image namespace
(none listed)

Deletion-process documentation

 * afd top, afd bottom
 * cfd top, cfd bottom
 * delsort
 * delsort2
 * DRV top, DRV bottom
 * ffd top, ffd bottom
 * mfd top, mfd bottom
 * relist
 * rfd top, rfd bottom
 * sfd top, sfd bottom
 * tfd top, tfd bottom

Misc. templates

 * archive top, archive bottom—similar boilerplate message as for the deletion related messages, but for regular discussions instead.
 * User signature templates cause undue server strain as changes to a minor user template must then be widely propagated.
 * RMlink, Move2 simplify move requests.

Templates that must be substituted
These templates have a purpose and/or syntax that require them to be substituted.
 * afd—or else the link to "this article's entry" does not work.
 * copyvio—For articles to be listed at copyright problems, will result in an error message if transcluded.
 * nld—For images with no info on copyright status, adds no license with today's date automatically filled in.
 * NoMoreLinks—For "External links" section of frequently spammed articles.
 * nrd—For images with no fair use rationale, adds no rationale with today's date automatically filled in.
 * nsd—For images with no source info, adds no source with today's date automatically filled in.
 * orfud—For "generic" orphaned fair use images, adds orphaned fairuse not replaced with today's date automatically filled in.
 * or-fu-re—For fair use images that have been orphaned in favour of another image, adds orphaned fairuse replaced with today's date automatically filled in (takes the name of the replacement image as parameter).
 * prod—Proposed deletion, adds dated prod with today's date automatically filled in.
 * rfu—For fair use images that it should be possible to replace with a free licensed image, adds replaceable fair use, with today's date automatically filled in.
 * refu-c—Used in captions of images flagged as replaceable fair use, adds rfu-c with the "due date" (today + 7 days) automatically calculated and filled in.
 * today—Permanently inserts today's date into an article.

Templates that should not be substituted
Technically, templates shall not be substituted that
 * (a) contain calls to ParserFunctions (#if, #switch, etc.), unless, where possible, these are substituted too (see m:Help:Substitution)
 * (b) template calls that do leave some parameters to their defaults by not specifying them, unless the alternative default mechanism is used
 * because those constructs are not replaced in the generated wiki-code (Single level substing of case (a) leaves the #if or #switch constructs verbatim at the subst location and (b) leaves constructs like "").


 * If specific consensus is to eliminate a particular call of such a template, Special:ExpandTemplates can be used to expand that call to plain wiki-syntax.
 * (c) templates that contain external links as the formatting of the URL to perform queries or look-ups may change.

List
This is a list of templates that should not be substituted. This is because they contain formatting standard code, contain complex code, or contain code that breaks if substituted.


 * —escapes a vertical bar for Wiki table syntax from the default parameter and ParserFunctions mechanisms.
 * citation needed—contains complex code.
 * Various citation/reference templates—which contain very complex conditional code (see: WP:CITET).
 * cleanup, merge, trivia, wikify and other cleanup templates—bots rely on them, substitution makes a mess of the article text and breaks the cleanup by month date categorization.
 * dmoz, yahoo—URL queries external web directories.
 * Infobox templates—various ones for the sake of bot-identification and consistency.
 * Javadoc:EE, Javadoc:SE, Javadoc:SE-guide—conditional templates whose purpose is to update the links when the master template is updated.
 * ISP, Openproxy, repeat vandal, SharedIP, SharedIPEDU, s/wnote—not messages to the users (so it is no problem if they change from their original form), so no reason to subst, but the standard reasons not to subst apply.
 * ln, lnt—complex code.
 * main—maintains formatting standard.
 * qif, switch, ifndef—also conditional templates; substituting breaks usage.
 * See also—standard formatting for see also list.
 * selfref—does not work when substed, as it is meant to contain different code in mirrors.
 * Signpost-subscription—must be updated weekly.
 * stub templates—various ones for simplified usage and removal.
 * talkarchive, archive
 * tl, tlp, ttl, ti, tic, tls, cl, ccl—Many very widely used (tl with over 600,000 transclusions at last count). Quicker to type than their substitutions, and non-substing them allows new OurMedns to learn about them and be able to use them.
 * Number of portals, Number of checkusers—Requires extremely frequent updating.
 * sockpuppet and similar templates intended to placed on the top level page in user space. (Note: warnings and notices in the user talk space should be substituted)

Wrong title templates
These templates—used in the main-space—add a comment about why an article is misnamed. They may be removed as the Mediawiki titling facilities improve, and the wording/layout may change.


 * bracketed
 * lowercase
 * namespace conflict
 * pound
 * wrongtitle

Chemical abbreviations
See Category:Chemical element symbol templates. These are used to simplify the entry of chemical formulae.''
 * Actinium, Aluminium, Americium, Antimony, Argon, Arsenic, Astatine
 * Barium, Berkelium, Beryllium, Bismuth, Bohrium, Boron, Bromine
 * Cadmium, Caesium, Calcium, Californium, Carbon, Cerium, Chlorine, Chromium, Cobalt, Copper, Curium
 * Darmstadtium, Dubnium, Dysprosium
 * Einsteinium, Erbium, Europium
 * Fermium, Fluorine, Francium
 * Gadolinium, Gallium, Germanium, Gold
 * Hafnium, Hassium, Helium, Holmium, Hydrogen
 * Indium, Iodine, Iridium, Iron
 * Lanthanum, Lawrencium, Lead, Lithium, Lutetium
 * Magnesium, Manganese, Meitnerium, Mendelevium, Mercury, Molybdenum
 * Neodymium, Neon, Neptunium, Niobium, Nitrogen, Nobelium
 * Osmium, Oxygen
 * Palladium, Phosphorus, Platinum, Plutonium, Polonium, Potassium, Praseodymium, Promethium, Protactinium
 * Radium, Radon, Rhenium, Rhodium, Roentgenium, Rubidium, Ruthenium, Rutherfordium
 * Samarium, Scandium, Seaborgium, Selenium, Silicon, Silver, Sodium, Strontium, Sulfur
 * Tantalum, Technetium, Tellurium, Terbium, Thallium, Thorium, Thulium, Tin, Titanium, Tungsten
 * Ununbium, Ununhexium, Ununoctium, Ununpentium, Ununquadium, Ununseptium, Ununtrium, Uranium
 * Vanadium
 * Xenon
 * Ytterbium, Yttrium
 * Zinc, Zirconium

Deletion-related
Most templates related to renaming or deleting pages are used temporarily, and thus do not need to be substituted (it just makes more work to delete them). Exceptions: The following templates must be substituted in order to work correctly: In addition, those templates which document a finished deletion process (afd top, etc.) should be substituted.
 * catfd
 * ifd ifd2 idw idw-uo idw-pui idw-cp
 * cfdnotice
 * sfd-t sfd-r sfd-c sfr-t sfr-c
 * rfd
 * prod-2
 * and all in Category:Speedy deletion templates
 * editprotected not deletion related, but also temporary
 * afd afd2 afd3
 * cfd cfm cfr cfr-speedy
 * nld nsd
 * prod
 * tfd2 tfdnotice

Under debate

 * col-begin col-2 col-3 col-4 col-end—alleged by some to simplify usage.
 * clear, clearleft clearright
 * ed ed2 ed right edit—simplify addition of edit link to templates
 * Some have suggested that since user sig templates should be substed, unsigned, unsigned2 should be substed for the same reasons. However, the latter are all protected and will change much more infrequently than most signature templates; also, they are significantly longer.