Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 About subst:  



1.1  Definition  





1.2  Usage  





1.3  Benefits  





1.4  Neutral  





1.5  Drawbacks  







2 Templates that should always be substituted  



2.1  Article namespace  





2.2  Article talk  





2.3  User talk namespace  





2.4  File namespace  





2.5  Misc. templates  





2.6  Uncategorized suggestions  







3 Templates that must be substituted  





4 Templates that should not be substituted  



4.1  List  





4.2  Wrong title templates  





4.3  Deletion-related  







5 Under debate  





6 See also  














Wikipedia:Substitution









 

Edit links
 









Project page
Talk
 

















Read
View source
View history
 








Tools
   


Actions  



Read
View source
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 





Page semi-protected

From Wikipedia, the free encyclopedia
 

(Redirected from Wikipedia:SUBST)

Substitution is a different way of handling templates than normally done on Wikipedia. Usually, templates are transcluded, which means that if the template changes, every page that uses it will update to comply with the change-in-question. This is the procedure used for most templates. However, some templates are instead substituted. This means that if the template changes, the page that uses it will not, and will continue to show the old version of the template. Some templates should always be substituted, while most should always be transcluded.

To substitute, add subst: after the opening braces, as in {{subst:page name}}. For example: substitution {{subst:Medicine}} in contrast to transclusion {{Medicine}}. The contents of Template:Medicine will be expanded (for any templates) and stored at each point where "{{subst:Medicine}}" is placed in a page. Note that ref tags refuse to run "subst:" unless temporarily renamed as "<xref name=xx>" or similar (see the bug report at T4700).

This page also lists templates that should either always or never be substituted except in the Wikipedia namespace. Automated tools (a.k.a. bots) that do such replacements will never be used on the original template. 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.

About subst:

Definition

The subst: keyword (short for "substitution") is used inside template code, placed as a prefix before the name of the template but within the curly braces ({{}}). It changes the way the MediaWiki 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 braces 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, {{template}} becomes {{subst:template}}, until you save the page. The next editor sees not the template call, but instead the text of the template when you saved; it does not change even if the original template is edited.

Usage

You can substitute a template tag by adding "subst:" to it. For example, use {{subst:test5}} instead of {{test5}}.

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}}", "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 a hidden comment to the template page helps article editors to see how templates are being used (e.g. <!-- Substituted from Template:Documentation -->). Use {{subst:html comment}} if you want to write HTML comments that contain wikitext expansions.

Benefits

Neutral

Drawbacks

Templates that should always be substituted

This is a list of templates that should always be substituted, organized by namespace. Each list is ordered alphabetically with grouped series. This is not a comprehensive list; other less-used templates may also need to be substituted, see the template's documentation for details.

Article namespace

Article talk

User talk namespace

All of the templates listed in Category:User warning templates and Category:Welcome templates should be substituted. This does not apply to templates on the user page.

File namespace

Misc. templates

Uncategorized suggestions

Templates that must be substituted

These templates have a purpose and/or syntax that require them to be substituted.

Templates that should not be substituted

Technically, templates should not be substituted that:

  1. contain calls to ParserFunctions (#if, #switch, etc.), unless, where possible, these are substituted too (see mw:Manual:Substitution#Multilevel substitution)
  2. leave some parameters to their defaults by not specifying them, unless the alternative default mechanism is used
  3. contain external links as the formatting of the URL to perform queries or look-ups may change

This is because these constructs are not replaced in the generated wiki-code (single level substituting of case (A) leaves the #ifor#switch constructs verbatim at the subst location and (B) leaves constructs like {{{1|default value}}}).
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.

List

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

Note also that some things may appear to be templates but are actually magic words, such as {{!}} and {{noexternallanglinks}}. Substituting them either will output nothing, or will substitute a template that shadows them (like the deprecated Template:!).

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.

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.

Under debate

See also


Retrieved from "https://en.wikipedia.org/w/index.php?title=Wikipedia:Substitution&oldid=1227433026"

Categories: 
Wikipedia editing guidelines
Wikipedia glossary items
Wikipedia template guidelines
Wikipedia how-to
Wikipedia template help
Hidden categories: 
Wikipedia semi-protected project pages
Wikipedia move-protected project pages
 



This page was last edited on 5 June 2024, at 17:59 (UTC).

Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



Privacy policy

About Wikipedia

Disclaimers

Contact Wikipedia

Code of Conduct

Developers

Statistics

Cookie statement

Mobile view



Wikimedia Foundation
Powered by MediaWiki