Wikipedia:Transclusion

  • transclusion means the inclusion of the content of one document within another document by reference. in wikipedia transclusion, the mediawiki software will refer to the content of one page, the template, for inclusion into the content of any other page, the target page. similar to the way any page name can become a link by placing its name in double square brackets, any page name can become a template by placing it in double curly braces, . changes made to the template are then automatically reflected on all pages into which that page has been transcluded (though a purge may sometimes be necessary).

    if the template's page name does not begin with a namespace, it is assumed to be in the template namespace. to refer to a page in the "main" (article) namespace, it is necessary to prefix it with a colon (:). examples:

    • will transclude from the page template:stochastic processes
    • will transclude from the page stochastic processes (an article, in the main namespace)
    • will transclude from the page wikipedia:assume good faith

    what will transclude from a page can be controlled with the tags <noinclude>, <onlyinclude> and <includeonly> placed in the source page wikitext. (see markup, below.) the use of tags enables the template to transclude partially, otherwise the double curly braces will always transclude all content. for selective transclusion the <includeonly> parts of the template are named (with the help of parser functions) and that template is then called with the parameter transcludesection=name.

    transclusion events occur every time the page is loaded, when the template is rendered. another use of the same mechanism is a one-shot substitution of the template call itself by its transcluded source page. a template call is transcluded once but never again, because the wikitext of that call is replaced (substituted) when its page is saved. what was a one-time template call becomes the actual wikitext of the template at the time of its call.

  • how transclusion works
  • transclusion syntax
  • applications of transclusion
  • partial transclusion
  • selective transclusion
  • subpages
  • special pages
  • see also

Transclusion means the inclusion of the content of one document within another document by reference. In Wikipedia transclusion, the MediaWiki software will refer to the content of one page, the template, for inclusion into the content of any other page, the target page. Similar to the way any page name can become a link by placing its name in double square brackets, any page name can become a template by placing it in double curly braces, . Changes made to the template are then automatically reflected on all pages into which that page has been transcluded (though a purge may sometimes be necessary).

If the template's page name does not begin with a namespace, it is assumed to be in the Template namespace. To refer to a page in the "Main" (article) namespace, it is necessary to prefix it with a colon (:). Examples:

What will transclude from a page can be controlled with the tags <noinclude>, <onlyinclude> and <includeonly> placed in the source page wikitext. (See markup, below.) The use of tags enables the template to transclude partially, otherwise the double curly braces will always transclude all content. For selective transclusion the <includeonly> parts of the template are named (with the help of parser functions) and that template is then called with the parameter transcludesection=name.

Transclusion events occur every time the page is loaded, when the template is rendered. Another use of the same mechanism is a one-shot substitution of the template call itself by its transcluded source page. A template call is transcluded once but never again, because the wikitext of that call is replaced (substituted) when its page is saved. What was a one-time template call becomes the actual wikitext of the template at the time of its call.