Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Help:Transclusion
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
<noinclude> {{pp-vandalism|small=yes}} {{Pp-move-indef}} </noinclude> {{redirect|WP:TRANS}} {{Broader|Transclusion}} {{Information page|H:TRANS|H:TRANSCL|WP:TRANS|WP:TRANSCL}} '''Transclusion''' refers to the inclusion of the content from one document within another document by [[Reference (computer science)|reference]]. In Wikipedia, transclusion means the [[MediaWiki]] software retrieving the content from a ''source'' ''page'', often a ''[[Wikipedia:Template|template]]'', and incorporating it into the content of a ''target page''. <!--How transclusion works--> Similar to creating a [[Wikipedia:Link|wikilink]] using double square brackets (<code><syntaxhighlight lang="wikitext" inline="">[[Pagename]]</syntaxhighlight></code>), a page can be transcluded as a template by enclosing its title in double curly braces or double curly brackets: <syntaxhighlight lang="wikitext" inline="">{{Namespace:Pagename}}</syntaxhighlight>. Any changes made to the source page, or template, are automatically reflected on all pages that include the transcluded content.{{refn|group=lower-alpha|A [[Wikipedia:Purge|purge]] may occasionally be necessary to refresh target pages, ensuring they retrieve and display the latest content from the template or source page. This forces the MediaWiki software to clear the cached version of the page and reload it with the most up-to-date transcluded content.}} <!--Namespace rules--> If no [[Wikipedia:Namespace|namespace]] is specified, it is assumed to be in the [[Wikipedia:Template namespace|Template namespace]]. To refer to a page in the [[Wikipedia:MAINSPACE|Main article namespace]], it is necessary to prefix it with a colon (<code>:</code>). For example: * <syntaxhighlight lang="wikitext" inline="">{{Pagename}}</syntaxhighlight> is the same as <syntaxhighlight lang="wikitext" inline="">{{Template:Pagename}}</syntaxhighlight> * <syntaxhighlight lang="wikitext" inline="">{{Stochastic processes}}</syntaxhighlight> will transclude from the page [[Template:Stochastic processes]] * <syntaxhighlight lang="wikitext" inline="">{{:Stochastic process}}</syntaxhighlight> will transclude from the page [[Stochastic process]] (an article, in the Main namespace) * <syntaxhighlight lang="wikitext" inline="">{{Wikipedia:Assume good faith}}</syntaxhighlight> will transclude from the page [[Wikipedia:Assume good faith]] <!--Controlling transclusion--> Transclusion and what content it includes or excludes can be modified by using the invisible [[Wikipedia:Wikitext|wikitext]] tags {{tag|noinclude|open}}, {{tag|onlyinclude|open}}, {{tag|includeonly|open}}, and {{tag|section|open}} on the {{em|source page}}, as further outlined in {{Section link|Help:Transclusion|Transclusion markup|nopage=y}}.{{refn|group=lower-alpha|Transclusion relies on functions that parse the source page, meaning that the appropriate wikitext markup must be present on the ''source page'' for it to correctly include or exclude content. The specific tags used for this purpose determine how the content will be transcluded into the target page. Properly implementing these tags allows editors to control the visibility of certain parts of the content based on the needs of the target page.}} The first three tags enable {{Section link|Help:Transclusion|Partial transclusion|nopage=y}}, as opposed to the default behavior of double curly braces, which will transclude the entire source page's content. For {{Section link|Help:Transclusion|Selective transclusion|nopage=y}}, the {{tag|includeonly|open}} or {{tag|section|open}} tags can be used and sections of the source page named, then using [[Wikipedia:Parser functions|parser functions]] the template can be called with the section name as a [[Help:Template#Parameters|parameter]]: <syntaxhighlight lang="wikitext" inline="">{{#section:Pagename|Sectionname}}</syntaxhighlight>. <!--Transclusion vs. Substitution--> Transclusion events occur each time the ''target page'' is loaded and the template is rendered. A related event is [[Wikipedia:Substitution|Substitution]], where a template call is replaced with its transcluded source content at the time it is invoked in a ''one-time'' inclusion of the content. Unlike transclusion, which continuously updates the target page with changes from the source, substitution results in a ''one-time'' inclusion of the content, meaning that subsequent updates to the source content ''will not'' be reflected in the target page. For example, a template call for <syntaxhighlight lang="wikitext" inline="">{{Pagename}}</syntaxhighlight> with the <syntaxhighlight lang="wikitext" inline="">subst:</syntaxhighlight> prefix results in the substitution template call <syntaxhighlight lang="wikitext" inline="">{{subst:Pagename}}</syntaxhighlight>. When invoked, this template is replaced, also referred to as substituted, with the actual wikitext of the source page at the time of the call, thereby making it a permanent part of the target page.{{refn|group=lower-alpha|In simpler terms, the page is ''published'' or ''saved'', and any future changes to the source page will not affect this substituted content.}} <!--Transcluding from Wikidata--> It is possible to [[Wikipedia:Wikidata#Inserting Wikidata values into Wikipedia articles|transclude content from Wikidata]] into Wikipedia articles or other wikis.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)