Transclusion is a function of the MediaWiki software that allows the content of one page to be included in the content of another page. In general, transclusion means any inclusion of the content of one electronic document into the content of another document. It is accomplished by markup language elements. Wikitext uses curly-brackets in the target and tags in the source. These specify the reference precisely. When placing such a reference, the transclusion is automated so that any subsequent change made to a source page is reflected whenever the target page is rendered by the user.
At the target document where the basic wikitext syntax {{Namespace:Name}}
is indicated, there will render on the user's display the source of the transclusion that is the content of the page named Namespace:Name. If the referenced (target) page name does not begin with a namespace identifier (Namespace:), it is assumed to be in the Template namespace. (A template is a page whose sole purpose is to be the source of a transclusion, hence the curly-brackets.) To refer to a page in the "Main" (article) namespace, it is necessary to prefix it with a colon (:). Examples:
- {{Like}} will transclude from the page Template:Like - specifically: Like
- {{Stochastic processes}} will transclude from the page Template:Stochastic processes
- {{:Calculus}} will transclude from the page Calculus (in the Main namespace)
- {{WP:Assume good faith}} will transclude from the page Wikipedia:Assume good faith
The markup that may be needed to accomplish a #partial transclusion of the source document is completely explained below.
Concerning template language in general, it is also possible to pass parameters to a template, using the expanded syntax described at Help:Template, which can affect what text in the template is rendered. For example, to highlight text like this, the text-to-be-highlighted is passed as a parameter to the highlight template: {{highlight|this}}
.
Considering alternative to transclusion, there is substitution. Substution causes the wikitext template to be overwritten by the source when the editor saves a page. The references is included by copying at the document-saving process, rather than transcluded by the document-rendering process. The source becomes an indistinguishable part of the saved page, independent of any later changes made to the template (source). The syntax for this is {{subst:Template name}}