Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Help:Transclusion
(section)
Help page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
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!
==Partial transclusion== {{shortcut|WP:PARTRANS}} By using {{tag|noinclude|o}}, {{tag|includeonly|o}} and {{tag|onlyinclude|o}} markup, it is possible to transclude ''part'' of a page, rather than all of it. Such partial transclusions can be achieved by transcluding from any pages, including subpages. It is often useful to exclude part of a page in a transclusion, an example being with template documentation. For an example of how this technique can be applied to simplify the creation of [[Wikipedia:Summary style|summary articles]], see how part of the [[History of pathology]] (see the diff [http://en.wikipedia.org/w/index.php?title=History_of_pathology&diff=prev&oldid=207668817 here]) was transcluded into [[Pathology]] (see the diff [http://en.wikipedia.org/w/index.php?title=Pathology&diff=prev&oldid=207669487 here]) using the <syntaxhighlight lang="wikitext" inline>{{:History of pathology}}</syntaxhighlight> markup. The Pathology article at that time (see [https://en.wikipedia.org/w/index.php?title=Pathology&oldid=207669487 here]) mainly consisted of transcluded [[Wikipedia:Manual of Style/Lead section|lead paragraphs]] and other sections from a number of articles. Look at the source to see how this was done. Since then, the Pathology article has been rewritten, and does not include all these transclusions. Another example can be found in the transclusion of part of [[HitRecord]] (introductory paragraph only) into a same-named summary section in [[Joseph Gordon-Levitt#HitRecord|Joseph Gordon-Levitt]]. {{anchor|Transclusion markup}} <!--Temp anchor until renamed section is checked for link breakage via ''what links here''--> ===Markup=== {{also|Help:Template#Noinclude, includeonly, and onlyinclude|Help:Category#Categories and templates}} In transclusion, a source page is transcluded into a destination page. But with partial transclusion, only part of that source page will be transcluded into a destination page. But in addition, what is transcluded to a destination page does not have to be visible on the source page. ''Page rendering'' of a source page can be defined as the rendering of that source page when it is saved, which will be the same as the [[wikipedia:WP:preview|preview]]. We can call this rendering '''''here'''''. ''Transclusion rendering'' of a source page can be defined as the rendering of a destination page that has a source page transcluded into it; but only that part of the destination page that was transcluded from the source page. The preview of the transclusion rendering will again be identical. We can call this rendering '''''there'''''. There are three pairs of tags involved in cases where page rendering ''here'' should differ from transclusion rendering ''there''. As described earlier, these are {{tag|noinclude|o}}, {{tag|includeonly|o}} and {{tag|onlyinclude|o}}. These tags are invisible, but affect both page rendering ''here'' and transclusion rendering ''there''. These tags pair-off to demarcate sections that will create differences. Each tag will describe exceptions to transcluding the whole page named. <pre> <noinclude> This section is visible here; but this section is not visible there. Sections outside of these tags will be visible both here and there. </noinclude> <onlyinclude> This section is visible here; this section is also visible there. Sections outside of these tags will be visible here, but will not be visible there. </onlyinclude> <includeonly> This section is not visible here; but it is visible there. Sections outside of these tags will be visible both here and there. </includeonly></pre> {| class="wikitable" style="text-align: center;" ! Wikitext ! What is rendered ''here'' (source page) ! What is transcluded ''there'' (destination page) |- |{{tag|noinclude|content=text1}} text2 |<code>text1 text2</code> |<code>text2</code> |- |{{tag|onlyinclude|content=text1}} text2 |<code>text1 text2</code> |<code>text1</code> |- |{{tag|includeonly|content=text1}} text2 |<code>text2</code> |<code>text1 text2</code> |} An important point to note is that {{tag|noinclude|o}} and {{tag|onlyinclude|o}} do not affect what is page rendered ''here'' at all, unlike {{tag|includeonly|o}}. The {{tag|noinclude|o}} tags stops text inside the tags being transcluded ''there'', while {{tag|onlyinclude|o}} has the opposite effect: it stops text outside of the tags from being transcluded ''there''. Only {{tag|includeonly|o}} stops text from being page rendered ''here''. But naturally enough it is transcluded ''there''. Text outside of the tags will be both rendered ''here'' and transcluded ''there''. There can be several such sections. Also, they can be nested. All possible differences between ''here'' and ''there'' are achievable. One example is a content editor who picks an {{tag|onlyinclude|o}} section, and then takes a {{tag|noinclude|o}} section out of that; but then picks out yet another {{tag|onlyinclude|o}} section to append to ''there''; but none of this affects their article in any way. Another example is the template programmer, who will {{tag|includeonly|o}} the code section and {{tag|noinclude|o}} the documentation section of a page.
Summary:
Please note that all contributions to Red Letter Media Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
RLMWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width