Difference between revisions of "User:Timbeale/transclusion"

(Created page with "Sandpit page to demonstrate transclusion. Sometimes you only want to transclude ''part'' of a wiki page, e.g. a key paragraph or section. The rest of the wiki page might cont...")
 
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
Sometimes you only want to transclude ''part'' of a wiki page, e.g. a key paragraph or section. The rest of the wiki page might contain other info that, while still useful, isn't related to the point you want to reiterate.
 
Sometimes you only want to transclude ''part'' of a wiki page, e.g. a key paragraph or section. The rest of the wiki page might contain other info that, while still useful, isn't related to the point you want to reiterate.
  
You can wrap the key paragraph in <nowiki><onlyinclude></nowiki> markers. You can only use these markers once per page. For example:
+
You can wrap the key paragraph in &lt;onlyinclude&gt; markers. You can only use these markers once per page. For example:
  
<onlyinclude>
+
<onlyinclude>'''Here!''' This paragraph is wrapped in &lt;onlyinclude&gt; markers. It is both visible on the original page it appears on, and any other page that transcludes the original.</onlyinclude>
Here! This paragraph is wrapped in <nowiki><onlyinclude></nowiki> markers. It is both visible on the original page it appears on, and any other page that transcludes the original.
 
</onlyinclude>
 
  
There are other transclusion markers - <nowiki><includeonly></nowiki> and <nowiki><noinclude></nowiki>. However, these get more complicated, as the content it wraps does not appear visible on the original page.
+
There are other transclusion markers - &lt;includeonly&gt; and &lt;noinclude&gt;. However, these get more complicated, as the content it wraps does not appear visible on the original page.

Latest revision as of 20:29, 27 November 2018

Sandpit page to demonstrate transclusion.

Sometimes you only want to transclude part of a wiki page, e.g. a key paragraph or section. The rest of the wiki page might contain other info that, while still useful, isn't related to the point you want to reiterate.

You can wrap the key paragraph in <onlyinclude> markers. You can only use these markers once per page. For example:

Here! This paragraph is wrapped in <onlyinclude> markers. It is both visible on the original page it appears on, and any other page that transcludes the original.

There are other transclusion markers - <includeonly> and <noinclude>. However, these get more complicated, as the content it wraps does not appear visible on the original page.