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 source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
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!
===Parametrization method=== =====Source document markup===== Insert the following line into the "source" document (the one from which text is to be transcluded), immediately preceding the first line of each section to be transcluded, substituting SECTIONNAME (twice) with the unique name of the respective section. The section name can be any identifier and must be unique within that document: :<syntaxhighlight lang="wikitext" inline><onlyinclude>{{#ifeq:{{{transcludesection|SECTIONNAME}}}|SECTIONNAME|</syntaxhighlight> End each such transcludable section with: :<syntaxhighlight lang="wikitext" inline>}}</onlyinclude></syntaxhighlight> =====Target document markup===== To transclude a section marked as above into another page (the "target page"), use the following line on that page, substituting PAGENAME for the "source" document from which text to be transcluded, and SECTIONNAME with the name of the section you want to transclude: :<syntaxhighlight lang="wikitext" inline>{{PAGENAME|transcludesection=SECTIONNAME}}</syntaxhighlight> Thus each section enclosed within <syntaxhighlight lang="wikitext" inline><onlyinclude> β¦ </onlyinclude> </syntaxhighlight> tags will always be rendered when the <code>transcludesection</code> parameter is not set (when the document is viewed ordinarily, or when the document is transcluded without setting the <code>transcludesection</code> parameter as shown below), and will be rendered by transclusion on any page that does set <code>transcludesection</code> to the section's name. It will ''not'' be rendered by transclusion that uses the <code>transcludesection</code> parameter but sets it to anything other than the name of the section. Also, when providing PAGENAME, without providing a [[Wikipedia:Namespace|Namespace]], the wiki will assume that the PAGENAME belongs in the [[Wikipedia:Template_namespace|Template Namespace]]. To transclude from a [[Wikipedia:Main_namespace|Mainspace]] article, use :PAGENAME. :<syntaxhighlight lang="wikitext" inline>{{:PAGENAME|transcludesection=SECTIONNAME}}</syntaxhighlight> =====Example===== If we want to make the "Principal Criteria" and "Common Name" sections of [[wikipedia:WP:TITLE]] be independently transcludable, we edit the WP:TITLE page and enclose the "Principal Criteria" section as follows: <syntaxhighlight lang="xml+smarty"> <onlyinclude>{{#ifeq:{{{transcludesection|principalcriteria}}}|principalcriteria| ... ''(text of "Principal Criteria" section)'' ... }}</onlyinclude> </syntaxhighlight> Similarly, we enclose the "Common Name" section with: <syntaxhighlight lang="xml+smarty"> <onlyinclude>{{#ifeq:{{{transcludesection|commonname}}}|commonname| ... ''(text of "Common Name" section)'' ... }}</onlyinclude> </syntaxhighlight> Then, to transclude the "Principal Criteria" section into another page, we insert into that page: :<syntaxhighlight lang="wikitext" inline>{{WP:TITLE|transcludesection=principalcriteria}}</syntaxhighlight> To transclude the "Common Name" section into another page, we insert into that page: :<syntaxhighlight lang="wikitext" inline>{{WP:TITLE|transcludesection=commonname}}</syntaxhighlight> Of course, the same page can transclude two or more sections this way by including multiple such lines. There is no limit to how many selectable sections for transclusion a document can have. The only requirement is that each <code>transcludesection</code> be given a value that is unique within that page. =====Additional markup for selectively transcluded sub-article leads===== {{further|Wikipedia:Summary style#Using excerpts for article synchronization}} Per [[MOS:LEAD#Format of the first sentence]], the first instance of the sub-article title should appear in bold in the first lead sentence of that article; this is often not desirable for a transclusion to a section of the parent article. In addition, the parent article is often wikilinked in the lead of a sub-article; when transcluded to the parent article, this wikilink will appear as bold text. The wikitext markup listed below can be used to address both of these problems. To ensure that the article title is bolded in the first sentence of the sub-article, but unbolded and wikilinked in the transclusion to the parent article, make the following replacement in the sub-article's first lead sentence: :Replace ::<code>'''{{var|SUB-ARTICLE_PAGENAME}}'''</code> :with ::<syntaxhighlight lang="wikitext" inline><noinclude>'''</noinclude>{{No selflink|{{var|SUB-ARTICLE_PAGENAME}}}}<noinclude>'''</noinclude></syntaxhighlight> If there is a wikilink to the parent article in the lead section of the sub-article, replacing the wikilink to the parent article with a {{tlx|no selflink}} template will ensure that it is wikilinked in the sub-article's lead but not in the transclusion to the parent article. In other words: # If the wikilink to the parent article is not a [[wikipedia:WP:Piped link]], replace <code>[[{{var|PARENT_ARTICLE}}]]</code> with {{tnull|no selflink|{{var|PARENT_ARTICLE}}}} in the sub-article's lead # If the [[Wikipedia:Piped link|wikilink to the parent article includes a pipe (e.g., this link)]], replace <code>[[{{var|PARENT_ARTICLE}}|{{var|Piped link wikitext}}]]</code> with {{tnull|No selflink|{{var|PARENT_ARTICLE}}|{{var|Piped link wikitext}}}} in the sub-article's lead
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