Wikipedia:Transclusion

(Redirected from Help:Transclusion)

Transclusion is when the contents of one page or document is included within another. 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.

How transclusion works

change
 

To transclude any source page (within a single MediaWiki project, such as simple:Wikipedia) within another target page, include the following code:

{{SOMEPAGE}}

Whenever the target page A with this code is rendered, the engine will include in that place not the code itself, but the entire content of the source page B, SOMEPAGE.

 
 

This would be a pretty neat trick if it only meant that you didn't have to copy-and-paste from one page to another. For example, you might decide to copy a welcome message to every newcomer's Talk page; you could do this with transclusion (though it might not be the best thing to do!).

But transclusion creates a "live" link between the "template" page and the target page where it appears. When the template is edited, all the other pages change, too.

For example, you might decide to create a (template) page with your mailing address and include that template on not only your page, but all your friends' pages, too. When you move your television and couch to another apartment, you will change your address template, and automatically, that new information will appear on all your friends' pages.

Examples

change

This very page uses template transclusion. The section above entitled "How transclusion works" is actually transcluded from the page Wikipedia:Transclusion/How Transclusion Works. This is done using the MediaWiki markup {{Wikipedia:Transclusion/How Transclusion Works}} to include it.

change

Templates

change
change