Help:Transclusion

Transclusion refers to the act of displaying the contents of one page onto another. This is done in a similar way to creating page links, except that curly braces are used instead of square brackets. For example, to link to the "Help:Editing" page, type. To transclude the contents of "Help:Editing", type. This will then cause the contents of "Help:Editing" to appear on the current page. When "Help:Editing" is later edited, the changes made will automatically be propagated to the pages that transclude "Help:Editing" (though a purge may be necessary).

Transclusion is usually used for templates, where the contents of one page are designed to be inserted into multiple pages, although transclusion can be used for other contexts as well.

Syntax
The basic syntax for transclusion is providing the full name of the page surrounded in curly brackets. Because transclusion is primarily intended for templates, if the namespace prefix is excluded, the target will default to the template namespace. This means that typing  has the same effect as typing  ; both will transclude the page "Template:Foo".

If a valid namespace prefix is provided, the corresponding page in that namespace will be transcluded. For example, to transclude the page "Help:Editing", type. If the namespace prefix provided is not valid (i.e. the namespace does not exist), it will default back to the template namespace.

To transclude pages from the main namespace (which do not have a namespace prefix in the title), a colon must be added immediately after the first set of curly brackets. For example, to transclude the page "Apple", type.

More advanced usage of transclusion syntax can be found on Help:Template. Although the page primarily covers templates created in the template namespace, it is possible for such code to be included in any namespace.

Applications
Transclusion has a wide variety of different uses, and are not solely limited to templates. Transclusion is very commonly used in the project namespace. For example, it may be useful to create a "composite page" that contains multiple different pages transcluded onto it in order to form a centralized hub where everything can be seen on the same page.

Articles can make use of transclusions as well. It may sometimes be useful to create lists and tables on a separate page and then transclude it into a more-commonly accessed page. This can be used if the list or table needs to be shown in multiple locations. If transclusion is used, the list or table will only need to be edited once for all changes to be propagated to other pages.

Partial transclusion
It is possible to specify only specific parts of a page to be transcluded. The, , and tags can be used to this effect. When these tags are used, only parts of a page will appear when it is transcluded into another.


 * will not include any of the contents placed inside of them onto target pages when the page is transcluded.
 * will include any of the contents placed inside of them onto target pages when the page is transcluded, but said content will not appear when the page is viewed directly.
 * will include any of the contents placed inside of them onto target pages and when the page is viewed directly, but anything not placed between these tags will not be transcluded.

Subpages
Subpages are transcluded like any other page (e.g. . However, if the page being transcluded is a subpage of the current page, it is possible to omit the first part of the name and only include  . For example, if you were editing the page "Foo", and you wanted to transclude the page "Foo/Bar" onto it, you can simply write.

Special pages
Some special pages allow themselves to be transcluded. Examples include Special:Allpages, Special:Prefixindex, Special:Newfiles, Special:Newpages, Special:Recentchanges and Special:Recentchangeslinked.
 * – a list of pages starting at "General".
 * – a list of pages with prefix "General".
 * – a gallery of the four most recently uploaded files.
 * – a list of the five most recently created pages.
 * – the five most recent changes.
 * – recent changes to the pages linked from "General".

URL parameters can be given like template parameters. For example,  will give the five most recent changes in the template namespace.