Help:Transclusion

From Meta, a Wikimedia project coordination wiki
(Redirected from Transclusion)
Jump to navigation Jump to search
Detailed reference page on this subject: Help:Template.

Transclusion refers to the process by which the entire contents of a page are inserted on to another page for the sake of convenience, speed of editing and/or tidiness of the source wikitext.

Syntax[edit]

The process works by applying the title of the page to be transcluded, with two braces {{}} on either side. If no namespace is provided, it defaults to the template namespace; adding a colon after the first pair of braces causes it to transclude from the main namespace instead.

Templates[edit]

Pages created for the sole purpose of being useful to transclude are known as templates. Templates come in many varieties; some templates constitute generic messages that can be quickly and easily sent, while others contain pieces of text that are used in mass quantities. The use for these quick pieces of text or code are almost limitless, and there are literally hundreds of thousands in current use all over Wikimedia. They have their own namespace, Template:.

The braces assume, and it is implied by default, that the template namespace is to be transcluded; i.e., the syntax assumes that {{FOO}} refers to Template:FOO. However, all kinds of pages can be transcluded in every namespace so long as the namespace is specified: e.g., {{Meta:Help}} would be a viable and workable transclusion. Because of template: vs (main) confusion when transcluding, pages with no namespace prefix, as this one (Transclusion), are transcluded with a colon preceding the page name, like this: {{:Transclusion}}.

Link that is created[edit]

It is important to remember that transclusion creates a very real and direct link between the target page and the transcluded one; when the source page is changed, the transcluded text is changed with it. This especially applies to templates that are in mass use; many pages can be altered very radically by a small change. The volatility of this situation should be considered when making changes.

It is possible to see what pages are transcluded on a page, and where a page is transcluded, by use of the "What links here" link in the toolbox in the left hand panel.

Embedded special pages[edit]

The default installation of MediaWiki allows you to embed only selected special pages, such as (depending on version):

See also Help:Special pages#Links to special pages.

Examples[edit]

The following is an example of a transclusion of Sample Page:

--- This page is a sample page, used as an example in Help:Embed page.

---


See also[edit]