Line 26: Line 26:
[[es:Ayuda:Sustituyendo plantillas]]
[[es:Ayuda:Sustituyendo plantillas]]
[[fr:Aide:Substitution de modèles]]
[[pl:Pomoc:Substytucja szablonów]]
[[pl:Pomoc:Substytucja szablonów]]

Revision as of 17:44, July 26, 2015

Template substitution is an alternate way to embed information contained in a template. Substitution is performed by placing the code subst: between the template braces, before the template name, like this:


How does substituting work?

Normally, when the code for a template named {{something}} is added to a page, it will display that template based on how it was designed at [[Template:Something]]. However, when you edit the page, you will still see {{something}} in the wikitext, instead of the full code of the template.

Non subst template

A template in the editor that has not been substituted.

However, if you substitute a template, the text {{subst:something}} will actually be replaced with whatever coding for the template is at [[Template:Something]]. If you edit the page again after saving, you will no longer see {{subst:something}} in the text.

Subst template

The same template after being substituted.

Why would I use this?

One reason is for things like welcome templates. Substituting these can be a good idea because welcome templates may change over time, and it can be odd to have someone's talk page change long after they have seen the notice. In addition, substituting it can give a better impression, as actual code can look more 'human' than text saying {{welcome}}.

See also

Further help and feedback

Community content is available under CC-BY-SA unless otherwise noted.