Transclusion

Transclusion is generally the inclusion of the content of a document into another document by reference. In the Wikipedian context, it is the use of the template functionality of MediaWiki to include the same content in multiple documents without having to edit those documents separately.

Partial transclusion
By using "noinclude", "onlyinclude" and "includeonly" markup, it is possible to transclude part of a page rather than all of it. Such partial transclusions can also be achieved by transcluding from other pages such as subpages. It is often useful not to transclude some information, such as template documentation.

For an example of how this technique can be applied to simplify the creation of summary articles, see Pathology, which consists of a collection of transcluded lead paragraphs from several main articles.

Transclusion markup

 * noinclude. The markup ... means that the text between the tags will not be transcluded onto another page, but will only appear on the page itself. This is useful for documentation.
 * includeonly. The markup ... means that the text between the tags will only be used when the page is transcluded onto another page, and will not appear on the page itself. This can be useful, for example, for adding categories to pages transcluding a template, without adding the template itself to these categories.
 * onlyinclude. The markup ... indicates that only text surrounded by "onlyinclude" markup should be transcluded onto another page. This is the most subtle of the partial transclusion tags because it often overrules the others. If there is at least one pair of "onlyinclude" tags on a page, then whenever this page is transcluded, it is only the material within the "onlyinclude" tags which gets transcluded. There can be several such sections, and within each such section, some material might be further excluded by "noinclude" tags, and might also be surrounded by "includeonly" tags so that it does not appear on the original page itself. But material outside the "onlyinclude" tags will be ignored when the page is transcluded onto another page. This can be useful, for example, to repeat a small part of one page on a second one: just surround the small part by onlyinclude tags, and transclude it onto the second page.

Subpages
One can cut and paste the text to be transcluded into a subpage, then use the name of the subpage in the transclusion template. This approach can only be used with subpages from User, Talk or Wikipedia pages; currently, subpages cannot be created from main article pages.

Example: you want to discuss the deletion and redirecting of Pussycat to Cat. First, create the subpage Talk:Pussycat/Let's delete Pussycat!, write your comment into it, then transclude it in Talk:Pussycat and Talk:Cat using the template   (note the colon before the page name). Comments posted in either talk pages will be shown in both.

Pages related to MediaWiki transclusion

 * MediaWiki namespace
 * m:Help:MediaWiki namespace
 * m:Help:Variable
 * Wikipedia talk:Template namespace

Templates

 * m:Help:Template
 * Template namespace
 * Template messages
 * Template limits
 * Avoid using meta-templates (rejected)