Wikipedia:Transclusion

From MedBib.com - Medicine & Nature

Shortcut:
WP:TRANS

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.

Contents

How transclusion works

Template syntax

If the source is in the Main article namespace (e.g., "Cat"), you must put a colon (:) in front of the name, thus: {{:Cat}}

If the source is in the Template namespace (e.g., "Template:Villagepumppages"), just use the name itself, alone, thus: {{Villagepumppages}}

If the source is in any other namespace (e.g., "User:Example"), you must use the full name, including the namespace, thus: {{User:Example}}

To transclude any source page (within a single MediaWiki project, such as en: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.

For example, you might decide to place a welcome message on every newcomer's Talk Page. Transclusion creates a "live" link between the template-page and the target-page(s) upon which the message should appear. When the template is edited, all the target-pages are edited 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.

Etymology

Ted Nelson coined the term "transclusion," as well as "hypertext" and "hypermedia", in his 1982 book, Literary Machines.

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

Pages related to MediaWiki transclusion

Templates

See also