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!
==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. 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 [[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.
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)