尿频尿急吃什么药| 数据是什么意思| 晕车药什么时候吃最好| 腹部包块是什么样子的| 验尿能检查出什么| 西瓜什么样的好吃| 88属什么| 贫血吃什么药| 报喜鸟属于什么档次| 生肖排第六是什么生肖| ab型血生的孩子是什么血型| 美人尖是什么| 疱疹用什么药| 心脏痛挂什么科| 成都立冬吃什么| 郑中基为什么叫太子基| 腱鞘炎什么症状| 什么什么大笑| 周岁和虚岁是什么意思| 综合能力测试考什么| 什么属相不能摆放大象| 叶酸是什么东西| 人到无求品自高什么意思| 酸菜炒什么好吃| 什么叫认知| 肌肉损伤吃什么药| 手抖吃什么药马上控制| 人绒毛膜促性腺激素是什么意思| dv是什么牌子| 金牛和什么星座最配| 孕妇心情不好对胎儿有什么影响| 喝苦荞茶有什么好处和坏处| 戴朱砂有什么好处| 夏天适合种什么植物| 什么是党的性质和宗旨的体现| 西海龙王叫什么| 升白针叫什么名字| 深圳居住证有什么用| 每次上大便都出血是什么原因| 萤火虫吃什么食物| 反响是什么意思| 胸椎退变是什么意思| 恋是什么意思| 神经质是什么意思| 猪尾巴炖什么好吃| 正常人尿液是什么颜色| 头晕是什么原因| 青光眼有什么症状| 屁股长痣代表什么| 善什么甘什么| 什么动物没有方向感| 子宫出血是什么原因| 梦到和别人打架是什么意思| 樱桃红是什么颜色| 长期失眠吃什么食物好| 阿司匹林肠溶片什么时候吃| 不可名状的名是什么意思| 老人适合喝什么茶| ck是什么| 尿不净是什么原因| 脚底脱皮用什么药膏| 衣原体感染吃什么药| 破涕为笑是什么意思| dd是什么意思| 冰室是什么意思| 什么是湿热| 火锅油碟是什么油| 世界上最难写的字是什么| 得宫颈癌的前兆是什么| 血压高看什么科| mac是什么| 痛风挂号什么科| 送向日葵代表什么意思| 微博id是什么| guess什么牌子| 菲字五行属什么| 药吃多了会有什么后果| 为什么智齿到晚上更疼| 白鹭吃什么| 做脑部检查挂什么科| 吴佳尼为什么嫁马景涛| 属蛇适合佩戴什么饰品| 身上老出汗是什么原因引起的| 什么颜色最防晒| 大圈什么意思| 坐月子能吃什么| 十二指肠球部溃疡吃什么药| 代沟是什么| 四个木字念什么| 肝钙化灶什么意思| 正事是什么意思| ex什么意思| 阑尾炎不能吃什么食物| 化疗和放疗有什么区别| 枯草芽孢杆菌治什么病| 下次闰六月是什么时候| 世家是什么意思| 脂蛋白a高吃什么能降下来| 艾草有什么功效| 8月30号是什么星座| 再生纤维素纤维是什么面料| 鱼香肉丝为什么没有鱼| 双肺斑索是什么意思| 为什么来月经肚子疼| 广州为什么叫羊城| 贪吃的动物是什么生肖| 大腿后侧疼痛什么原因| 慷慨解囊是什么意思| 打嗝是什么毛病| 嗓子疼是什么原因| 糖类抗原724偏高是什么原因| 男人爱出汗是什么原因| 一个王一个八念什么| 牙齿松动是什么原因| 八十岁是什么之年| 感冒为什么不能吃鸡蛋| 事业有成是什么意思| 什么是筋膜| 月经血块多是什么原因| 舌苔发白是什么情况| 什么渐渐什么| 长孙皇后叫什么名字| 眼睛晶体是什么| 什么花最香| lotus是什么车| 夷是什么意思| 海阔什么| 打新股需要什么条件| 鸡吃什么食物| 月经期间喝酒有什么危害| 夜间多梦是什么原因| 猫鼻支是什么症状| 例行是什么意思| 凝血酶原时间是什么意思| 什么无终| 什么是肝癌| 68年属猴的是什么命| 巨细胞病毒igg阳性是什么意思| 吃什么精力旺盛有精神| 吃皮蛋不能和什么一起吃| 薄熙来为什么被抓| tki是什么意思| 乙肝有抗体是显示什么结果| 胸腔积液是什么原因引起的| 盆底脱垂有什么症状| 缺钾吃什么食物| 嫣字五行属什么| 肝掌是什么症状| 铁树开花是什么意思| 上海有什么好玩的| 水瓶座女生和什么星座男生最配| 沉住气是什么意思| 吃什么东西化痰| 录取通知书是什么生肖| 夜盲症吃什么| 没有润滑油用什么代替| 什么人不适合戴翡翠| 儿童喝蜂蜜水有什么好处和坏处| 胃不舒服喝什么| mm代表什么单位| 上海属于什么方向| 碳水化合物是什么食物| 急性胰腺炎吃什么药| 脑死亡是什么意思| 虾吃什么| 吃的少还胖什么原因| 碘伏是什么| 青梅什么季节成熟| 八月十五是什么节日| 衣原体阳性是什么病| 天然呆是什么意思| 左手臂有痣代表什么| jhs空调是什么牌子| 燃气灶什么牌子好| 唯女子与小人难养也什么意思| 啧啧啧什么意思| 乳房边缘疼是什么原因| 守望先锋是什么类型的游戏| 凝血是什么意思| 小李子为什么叫小李子| 长时间憋尿会有什么影响| 脚发热是什么原因| 炖汤用什么鸡| 夫妻肺片是什么肉| 性生活有什么好处| 有缘无分是什么意思| 776是什么意思| 阳痿吃什么好| bruce是什么意思| peony是什么意思| 梦见孩子哭是什么意思| 胆结石能吃什么水果| 毛尖茶属于什么茶| 乳糖不耐受喝什么奶粉| 血脂高是什么原因| 肾囊肿有什么症状| shiraz是什么名字红酒| 怀孕后不能吃什么| rr医学上什么意思| 钟字五行属什么| 甲沟炎用什么药好| 巨峰葡萄为什么叫巨峰| 梦见游泳是什么预兆| 怀孕什么时候能测出来| 好景不长是什么意思| 妇科检查bv是什么意思| 四海扬名是什么生肖| 斐乐属于什么档次| 什么是精神出轨| 3p 什么 感觉| 一个王一个月念什么| 右耳朵热代表什么意思| zutter是什么意思| 破伤风挂什么科| 揩是什么意思| 怀孕10天有什么症状| 晚上剪指甲有什么禁忌| 财神爷叫什么名字| pp和ppsu有什么区别| 郑州有什么特产| 17楼五行属什么| 经常头晕头疼是什么原因| 去湿气吃什么最好| 什么样的人爱长结节| 蛇吐信子是什么意思| 反胃是什么原因引起的| 人到中年为什么会发胖| 德不配位是什么意思| 面瘫吃什么药好得快| 阴道有味道是什么原因| 妈妈是什么意思| 卧推80公斤什么水平| vip是什么意思| 经常反义词是什么| 什么不息| 口蘑是什么| 高血压用什么药| 为什么医生说直肠炎不用吃药| 烤鱼一般用什么鱼| 虫加合念什么| 小狗什么时候可以洗澡| 梦见很多蜜蜂是什么意思| 较重闭合性跌打损伤是什么意思| 车水马龙什么意思| 颈椎病用什么药最好| 几月初几是叫什么历| 扁平苔藓是什么病| 脸上长黑痣是什么原因| 英纳格手表什么档次| 救世主是什么意思| 吃了避孕药有什么副作用| 1961属什么生肖| 一月六日是什么星座| 冬天有什么花| 胆囊壁增厚是什么意思| 晚上睡觉多梦是什么原因| 人的五官指什么| 总胆固醇是什么| 华为什么手机好| 抓包是什么意思| 草字头一个辛读什么| 杨柳木是什么生肖| 天天打喷嚏是什么原因| 宝宝在肚子里打嗝是什么原因| 百度

互联网金融监测情况报告:新增收录1189家互金平台

百度 rm是什么意思

Transclusion refers to the inclusion of the content from one document within another document by reference. In Wikipedia, transclusion means the MediaWiki software retrieving the content from a source page, often a template, and incorporating it into the content of a target page.

Similar to creating a wikilink using double square brackets ([[Pagename]]), a page can be transcluded as a template by enclosing its title in double curly braces or double curly brackets: {{Namespace:Pagename}}. Any changes made to the source page, or template, are automatically reflected on all pages that include the transcluded content.[a]

If no namespace is specified, it is assumed to be in the Template namespace. To refer to a page in the Main article namespace, it is necessary to prefix it with a colon (:). For example:

Transclusion and what content it includes or excludes can be modified by using the invisible wikitext tags <noinclude>, <onlyinclude>, <includeonly>, and <section> on the source page, as further outlined in § Transclusion markup.[b] The first three tags enable § Partial transclusion, as opposed to the default behavior of double curly braces, which will transclude the entire source page's content. For § Selective transclusion, the <includeonly> or <section> tags can be used and sections of the source page named, then using parser functions the template can be called with the section name as a parameter: {{#section:Pagename|Sectionname}}.

Transclusion events occur each time the target page is loaded and the template is rendered. A related event is 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 {{Pagename}} with the subst: prefix results in the substitution template call {{subst:Pagename}}. 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.[c]

It is possible to transclude content from Wikidata into Wikipedia articles or other wikis.

How transclusion works

To transclude content from a source page within a single MediaWiki project (such as English Wikipedia) onto a target page, use {{SOURCEPAGE}} in the target page's code.

Whenever {{SOURCEPAGE}} is included on a target page, the WikiMedia software retrieves and embedes the entire content of SOURCEPAGE (i.e., Template:SOURCEPAGE) at that location on the target page.

Example

Consider an example, complemented by the illustration below, with target pages A, P, and Q, and source page B.

If source page B is transcluded into A, the content from B (for instance, the word "foo") will appear in place of the {{B}} code in page A. When transcluded, this content is not highlighted or boxed on the target page – it is integrated directly into the page's text (highlighted here only for illustration).

How it works

Transclusion creates a 'live' link between a source page and all target pages where its content is transcluded to and used. Editing the source page automatically updates its content on all target pages that include it.

For example, if you create a source page with details about a Wikimedia event and transclude it onto the talk pages of 50 editors you wish to invite, any updates you make to the source page (such as changing the event location) will immediately reflect on all 50 talk pages.

Edit source pages with caution

Edits to a source page can impact all target pages using it. If a source page also contains its own transclusions from other source pages, avoid changes that may break these links, as this would affect the source page you are editing and all target pages that transclude it. This is known as 'breakage', and it is best to ensure any updates maintain the integrity of transcluded content across all pages. For example, Main Page is a large page that transcludes its content from multiple embed source pages such as Wikipedia:Today's featured list.

Transclusion syntax

The general syntax for transclusion on Wikipedia follows the format {{Namespace:Pagename}}, where Namespace:Pagename specifies the title of a Wikipedia page.

Similar to creating a wikilink using double square brackets ([[Pagename]]), a page can be transcluded as a template by enclosing its title in double curly braces: {{Namespace:Pagename}}. Any changes made to the source page, or template, are automatically reflected on all pages that include the transcluded content.[d]

Wikipedia is structured using namespaces, which organize pages based on their function. For example, a page titled Wikipedia:Tips belongs to the Wikipedia namespace, with Wikipedia: as its namespace and Tips as its pagename. However, articles in the Main namespace, such as Potato, do not require a namespace prefix when linked using [[Potato]], as Wikipedia assumes any wikilink without a specified namespace belongs to the Article namespace.

When transcluding pages, if no namespace is specified, Wikipedia defaults to the Template namespace. To reference a page in the Article namespace within transclusion syntax, it must be explicitly prefixed with a colon : (e.g., {{:Potato}}).

Examples

  Summary: {{Pagename}} or {{Template:Pagename}} will transclude the content of Template:Pagename.
{{:Pagename}} will transclude the mainspace article titled Pagename.
{{Namespace:Pagename}} transcludes a page in the defined namespace, such as Help:Pagename.
  • Specifying namespace: {{Namespace:Pagename}} will transclude the page titled Namespace:Pagename. For example, if a page has the wikitext {{Wikipedia:Notability}} in it, it will transclude the page Wikipedia:Notability into it. Please note that {{WP:Notability}} would do exactly the same thing, as WP: is a namespace alias, which is automatically translated by the Wikipedia servers to Wikipedia:.
  • Calling from the Article namespace: If the namespace is omitted, but the colon is included, like {{:Pagename}}, the mainspace article Pagename will be transcluded. For example, {{:Notability}} will transclude the article Notability.
  • Template namespace: If both namespace and colon are omitted, like {{Pagename}}, the Template:Pagename will be transcluded. For example {{Notability}}, and also {{Template:Notability}}, will both transclude the Template:Notability.

Additionally, specific § Template parameters and § Transclusion modifiers allow parameters to be passed to templates, alter how transclusion occurs, and therefore the output customized. This is explained in more detail below.

Subpages

Subpages, identifiable by a / prefixed in their page names, are pages related to a 'parent' page (e.g., Namespace:Pagename/Subpagename is a subpage of Namespace:Pagename). This feature is disabled in the Main, File, and MediaWiki namespaces, but not on their corresponding talk namespaces.

To transclude subpages:

  • In general, use {{Namespace:Pagename/Subpagename}}. With exception:
    • On the parent page of a subpage, the more specific general syntax mentioned above can be used or simply {{/Subpagename}}.
    • For a template namespace page, it is either the general syntax or {{Pagename/Subpagename}}.
    • Article subpages are disabled on this wiki, but would otherwise be {{:Pagename/Subpagename}}.
  • Alternatively, you can also use § Template parameters and § Transclusion modifiers.

For example, to transclude Template:Like/doc, you could use {{Template:Like/doc}} or {{Like/doc}}. Note that subpage names are case sensitive, and {{Like/Doc}} would lead to a different page.

Template parameters

The most common use of transclusion on Wikipedia is for templates. Templates are specially designed pages intended to be included in other pages using either transclusion or substitution. The standard syntax for transcluding a template titled Template:Pagename is {{Pagename}}.

Additionally, many templates support parameters, which are variables that allow templates to function in different ways by passing specific values, also termed arguments. Templates may have no parameters, use a fixed number of parameters, or support a variable number of parameters. The number of parameters a template can accept ranges from one to multiple, depending on its design.

The exact syntax for using parameters varies by template. However, for a hypothetical template titled Template:Pagename that accepts three parameters, the general format would be:

{{Pagename|parameter1|parameter2|parameter3}}

Where each parameter in a template can be substituted with either a value or a |parameter name=value format when used in practice. Notice that each parameter is separated by a vertical bar (|). Parameters that take the form value are called unnamed or positional parameters, while those in the form |parameter name=value are known as named parameters. With unnamed parameters, the first, second, and third parameters correspond to |1=, |2=, |3=, respectively, etc., in template documentation. Unnamed parameters must be provided in the correct order and are best placed before named parameters.[e]

For example, using the Template:Collapse top with two unnamed parameters and one named parameter:

 Y {{Collapse top|This is the title text|This is a custom warning line|left=true}}
 Y {{Collapse top|left=true|1=This is the title text|2=This is a custom warning line}}
 N {{Collapse top|left=true|This is the title text|2=This is a custom warning line}}

In this case, This is the title text and This is a custom warning line are the values of unnamed parameters |1= and |2=, while true is the value assigned to the named parameter |left=. The last example shows how unnamed parameters should not be used after named parameters without their 'name'. Although this example includes three parameters, Template:Collapse top can accept a variable number of parameters.

For more details, see Help:Template. Additionally, Wikipedia:Template index provides a categorized list of templates, including those for mainspace and other namespaces, along with a search function. Template parameters also play a role in the § Parametrization method of § Selective transclusion, allowing for more dynamic content inclusion.

Substitution

Transclusion events occur each time the target page is loaded and the template is rendered. A related event is 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 {{Pagename}} with the subst: prefix results in the substitution template call {{subst:Pagename}}. 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.[f]

For example, when {{subst:Like}} is inserted in a page and the changes published, it would substitute that wikitext with the actual wikitext from Template:Like. In practice, subsequent updates to Template:Like will not be reflected in the page it was substituted into.

Magic words

Magic words are not examples of transclusion. But some have a near identical double curly bracket syntax and similar action to transclusion. For example, {{FULLPAGENAME}} renders the full page name of any Wikipedia page, for example it returns Help:Transclusion on this page. Like templates, some magic words can also take parameters, which are separated using a colon (:); for example {{TALKPAGENAME:Help:Transclusion}} returns Help talk:Transclusion.

Templates do exist for some magic words, for example Template:FULLPAGENAME; but these just invoke the related magic word and pass parameters using the verticle bar (|) to the magic word in anycase; for example like {{FULLPAGENAME|value}}. But magic words parameters are best passed directly by using a colon, which bypasses the unnecessary use of a template call too. For example, {{FULLPAGENAME|value}} is synonymous with {{FULLPAGENAME:value}}, where the latter is preferred.

Transclusion modifiers

A transclusion modifier is a type of specialist magic word for altering transclusion in some manner. An example of which is the subst: modifier discussed above in § Substitution. Another example is {{:Notability}}, where the colon character (:) forces transclusion to the main namespace. There are additional transclusion modifiers such as safesubst:, int:, msg:, msgnw:, and raw:. For more details on their usage, see mw:Help:Magic words § Transclusion modifiers. Also see the modified commands #section:, #section-x: and #section-h: used for labeled section transclusion, see Help:Labeled section transclusion and the section § Using the labeled section method.

Usage

Transclusion is commonly used in templates, allowing content to be embedded dynamically across multiple pages. However, it is also applied in other contexts, particularly within project space, where it facilitates the management of structured content.

Composite pages

Composite pages are created by transcluding multiple component pages, either entirely or in part, into a central page. The wikitext of a composite page may include HTML tags to embed content, typically from standalone pages that are not part of the template namespace. The primary purpose of composite pages is to consolidate related content for easier access.

Examples

The use of composite pages allows users to view multiple related pages in one location rather than navigating through individual links.

Characteristics

Composite pages function independently from their component pages in several ways. While changes made to a component page are reflected on the composite page, the composite page maintains its own edit history, recent changes log, page-watch settings, and protection levels, separate from those of its transcluded content.

The talk page of a composite page is used specifically for discussions about the composite itself rather than for the individual component pages it includes. However, in some cases, a composite talk page may also transclude discussions from its component pages, allowing for a centralized discussion space.

When editing, users can modify sections of a component page directly from the composite page by selecting the edit section links generated by {{transcluding article}}, {{transcluded section}} and {{excerpt}}, which all employ {{transclusion notice}} to generate the notice. Once changes are saved, they are applied to the original component page, ensuring consistency across all instances where the content appears.

For projects that support interlanguage links, a composite page aggregates all interlanguage links from its component pages. This can sometimes lead to multiple links pointing to the same language or page, reflecting the structure of the transcluded content.

Pages with a common section

When two pages need to discuss the same material in the same way, they can share a section. For example, a section of an existing page may be transcluded to other pages. This may also involve creating a third page and transcluding that page onto both pages. This third page may be a standalone page in its own right for another purpose, or a subpage of either of the other two – except in the mainspace, where subpages are not allowed. The third page may be placed in the same namespace as the other pages or in template namespace – again, except for use in mainspace, where templates should not be used to store article text, as this makes it more difficult to edit the content (see Wikipedia:Template namespace). Common sections like this should be marked with an explanatory header, such as using the templates {{transcluding article}} or {{transcluded section}} to create hatnotes above the transcluded content, and/or given a special layout, to inform the reader that this section of the page is in a different location, since transcluding shared article sections can easily confuse novice editors and readers alike if left unmarked. All templates can be found at Category:Transclude page content templates.

This can be very useful when two disambiguation pages share content,[disputeddiscuss] or a list page and a disambiguation page share content (see second example below).

Examples:

Repetition within a page

On pages with a lot of repetitive information – typically lists or tables – it can be useful to create a template that contains the repeating text, and then call that template multiple times. For example, {{EH listed building row}} is used repeatedly to build tables in many articles.

For simple repetition of the same text, you can use a template like {{3x}}. For instance, {{3x|howdy!}} produces: howdy!howdy!howdy!

Partial transclusion

By using <noinclude>, <includeonly> and <onlyinclude> 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 summary articles, see how part of the History of pathology (see the diff here) was transcluded into Pathology (see the diff here) using the {{:History of pathology}} markup. The Pathology article at that time (see here) mainly consisted of transcluded 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.

Markup

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 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 <noinclude>, <includeonly> and <onlyinclude>. 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.

<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>
Wikitext What is rendered here (source page) What is transcluded there (destination page)
<noinclude>text1</noinclude> text2 text1 text2 text2
<onlyinclude>text1</onlyinclude> text2 text1 text2 text1
<includeonly>text1</includeonly> text2 text2 text1 text2

An important point to note is that <noinclude> and <onlyinclude> do not affect what is page rendered here at all, unlike <includeonly>. The <noinclude> tags stops text inside the tags being transcluded there, while <onlyinclude> has the opposite effect: it stops text outside of the tags from being transcluded there.

Only <includeonly> 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 <onlyinclude> section, and then takes a <noinclude> section out of that; but then picks out yet another <onlyinclude> section to append to there; but none of this affects their article in any way.

Another example is the template programmer, who will <includeonly> the code section and <noinclude> the documentation section of a page.

Selective transclusion

Selective transclusion is the process of partially transcluding one selected section of a document that has more than one transcludable section. As noted above, if only one section of a document is to be transcluded, this can be done by simply surrounding the section of interest with <onlyinclude></onlyinclude> tags, and transcluding the whole page. However, to selectively transclude one section from a template or document into one page, and another section from the same template or document into a second page and/or a different section of the same page, requires a way to:

a) uniquely mark each transcludable section in the source document; and
b) in the target document(s) (those to show the transcluded sections), a way to specify which section is to be transcluded.

This section describes how to accomplish this. There are three ways of doing this: (1) Section header-based transclusion, (2) Labeled section transclusion, and (3) the parametrization method.

Standard section transclusion

Standard section transclusion uses {{#section-h:PAGENAME|SECTIONNAME}}. One can easily transclude the content within a section from one page to another using the ubiquitous headline-based section headers used throughout Wikipedia. To transclude the lead section of an article with this method, one can use {{#section-h:PAGENAME}}. This method is simpler than other selective transclusion methods, which require special markup in the source article or page to specify what content should be included or excluded.

Standard section transclusion may introduce a leading or trailing line break or newline, depending on the markup in the source and target pages. To prevent this, wrap the transclusion code in a {{trim}} template. For example:

  • To transclude the section of an article: {{trim|{{#section-h:PAGENAME|SECTIONNAME}}}}
  • To transclude the lead of an article: {{trim|{{#section-h:PAGENAME}}}}

Hatnote on the target page

To indicate on the target page where selectively transcluded content originates (its source), a {{Transcluded section}} hatnote must be placed at the top of the corresponding section in the target page where the content is being transcluded to.[g][h] Use either of the following, depending on whether the transcluded content is the entire section or only part of it:

  • If an entire section in the target page is transcluded the source: {{transcluded section|source=PAGENAME#SECTION}}, which renders as:
  • If only part of a section in the target page is transcluded the source, specify |part=yes: {{transcluded section|source=PAGENAME#SECTION|part=yes}}, which renders as:

Hidden comment on the source page

It is recommended to include a hidden comment at the beginning of the transcluded section in the source page. This comment informs editors that the content is being used elsewhere and serves as a reminder to consider the broader audience when modifying the wording. Additionally, it helps maintain the integrity of the transcluded material on the target page. For example (replace [[PAGENAME#SECTION]] with the name of the target page):

<!-- The content of this section is transcluded to [[PAGENAME#SECTION]]. Please be aware that changes made to the original source here will affect the transcluded version on the target page mentioned. -->

No hatnote should be placed on the source page, in other words no hatnote is needed on the page being transcluded from, as readers do not need to know where else the content appears.

Using the labeled section method

Labeled-section selective transclusion uses the parser functions listed in mw:Extension:Labeled Section Transclusion, which are enabled on all Wikimedia wikis, to selectively transclude content. See Help:Labeled section transclusion for how labeled section transclusion works.

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:

<onlyinclude>{{#ifeq:{{{transcludesection|SECTIONNAME}}}|SECTIONNAME|

End each such transcludable section with:

}}</onlyinclude>
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:

{{PAGENAME|transcludesection=SECTIONNAME}}

Thus each section enclosed within <onlyinclude></onlyinclude> tags will always be rendered when the transcludesection parameter is not set (when the document is viewed ordinarily, or when the document is transcluded without setting the transcludesection parameter as shown below), and will be rendered by transclusion on any page that does set transcludesection to the section's name. It will not be rendered by transclusion that uses the transcludesection parameter but sets it to anything other than the name of the section.

Also, when providing PAGENAME, without providing a Namespace, the wiki will assume that the PAGENAME belongs in the Template Namespace. To transclude from a Mainspace article, use :PAGENAME.

{{:PAGENAME|transcludesection=SECTIONNAME}}
Example

If we want to make the "Principal Criteria" and "Common Name" sections of WP:TITLE be independently transcludable, we edit the WP:TITLE page and enclose the "Principal Criteria" section as follows:

<onlyinclude>{{#ifeq:{{{transcludesection|principalcriteria}}}|principalcriteria|
...
''(text of "Principal Criteria" section)''
...
}}</onlyinclude>

Similarly, we enclose the "Common Name" section with:

<onlyinclude>{{#ifeq:{{{transcludesection|commonname}}}|commonname|
...
''(text of "Common Name" section)''
...
}}</onlyinclude>

Then, to transclude the "Principal Criteria" section into another page, we insert into that page:

{{WP:TITLE|transcludesection=principalcriteria}}

To transclude the "Common Name" section into another page, we insert into that page:

{{WP:TITLE|transcludesection=commonname}}

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 transcludesection be given a value that is unique within that page.

Additional markup for selectively transcluded sub-article leads

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
SUB-ARTICLE_PAGENAME
with
<noinclude>'''</noinclude>{{No selflink|{{var|SUB-ARTICLE_PAGENAME}}}}<noinclude>'''</noinclude>

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 {{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:

  1. If the wikilink to the parent article is not a WP:Piped link, replace [[PARENT_ARTICLE]] with {{no selflink|PARENT_ARTICLE}} in the sub-article's lead
  2. If the wikilink to the parent article includes a pipe (e.g., this link), replace [[PARENT_ARTICLE|Piped link wikitext]] with {{No selflink|PARENT_ARTICLE|Piped link wikitext}} in the sub-article's lead

Drawbacks

Like many software technologies, transclusion comes with a number of drawbacks. The most obvious one being the cost in terms of increased machine resources needed; to mitigate this to some extent, template limits are imposed by the software to reduce the complexity of pages. Some further drawbacks are listed below.

Special pages

Some pages on Special:Specialpages can be transcluded, such as AllPages, PrefixIndex, NewFiles, NewPages, RecentChanges, WhatLinksHere (see help page), and RecentChangesLinked. Samples:

  • {{Special:AllPages/General}} – a list of pages starting at "General".
  • {{Special:PrefixIndex/General}} – a list of pages with prefix "General".
  • {{Special:NewFiles/4}} – a gallery of the four most recently uploaded files.
  • {{Special:NewPages/5}} – a list of the five most recently created pages.
  • {{Special:RecentChanges/5}} – the five most recent changes.
  • {{Special:RecentChangesLinked/General}} – recent changes to the pages linked from "General".
  • {{Special:Contribs/Larry Sanger|offset=20021108002158|limit=50}} – user contributions prior to November 2002, limited to 50.

Attempting to transclude {{Special:Categories}} will not result in an actual list of categories, but {{Special:PrefixIndex/Category:}} can be used for this purpose.

Except for Special:RecentChangesLinked, the slash, and the word or number after the slash, can be omitted, giving a list of pages without a specific starting point, or a list of the default length.

URL parameters can be given like template parameters:

  • {{Special:RecentChanges|namespace=10|limit=5}} – the five most recent changes in the "Template" namespace.
  • {{Special:PrefixIndex/Jimbo Wales/|namespace=2|stripprefix=1}} – the subpages for User:Jimbo Wales, but without the user page prefix.

Note: Transcluding certain special pages (such as Special:NewPages) can change the displayed title of the page.

Advanced concepts

Transclusion occurs before parsing and can emit syntax fragments, like HTML entities, to preserve them in the final render. The content being transcluded is processed and embedded before the target page is parsed and fully rendered. When transclusion happens at the HTML layer before parsing, it allows certain content – like syntax fragments such as character entity references like & and mp; or specific HTML components – to be inserted in their original form and preserved in the final render. However, this approach may cause pages to render incorrectly or violate the principle of least surprise for the reader.[i] It should be used sparingly when cleaner alternatives are not available. Emitting fragments of template syntax, such as opening braces ({{}}), is unlikely to re-parse correctly as template syntax in the target page, and it is unwise to rely on such behavior unless formally documented.

Notes

  1. ^ A 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.
  2. ^ 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.
  3. ^ In simpler terms, the page is published or saved, and any future changes to the source page will not affect this substituted content.
  4. ^ A 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.
  5. ^ Otherwise using value on its own will not work, and the unnamed parameters must be called using their 'names', such as |1=value, if named parameters precede them.
  6. ^ In simpler terms, the page is published or saved, and any future changes to the source page will not affect this substituted content.
  7. ^ No hatnote should be placed on the source page, in other words no hatnote is needed on the page being transcluded from, as readers do not need to know where else the content appears.
  8. ^ That is the hatnote should be placed below the header but above the content, per MOS:Layout.
  9. ^ For example, if whitespace, tabs, and newline HTML code are preserved without parsing, the final page may display awkward spacing, misalignments, or unexpected breaks. This whitespace is usually added in the source code to improve readability for developers and isn’t intended to appear in the published content.

See also

MediaWiki transclusion

Templates

Other

双肺纹理增强是什么意思 小媳妇是什么意思 温居是什么意思 胃泌素释放肽前体高是什么原因 翎字五行属什么
什么是淋巴 陕西有什么烟 鸡鸣寺求什么 金先读什么 每天吃维生素c有什么好处
十二生肖分别是什么 腮腺炎吃什么药 献殷勤是什么意思 推拿和按摩有什么区别 怀孕不到一个月有什么症状
一什么狼 镶什么牙实惠耐用 这是什么地方 什么鱼做酸菜鱼最好吃 前列腺增大吃什么药
郭敬明为什么叫小四hcv8jop5ns5r.cn 大肠杆菌是什么病hcv9jop2ns4r.cn 马后炮是什么意思hcv9jop2ns3r.cn 牛肉烧什么菜最好吃hcv9jop0ns7r.cn 慢性胰腺炎有什么症状cl108k.com
人生得意须尽欢是什么意思wuhaiwuya.com 宫颈纳囊用什么药治疗效果好hcv7jop9ns8r.cn 体检转氨酶高是什么原因dajiketang.com 感冒是什么原因引起的wuhaiwuya.com 三月份有什么节日hcv8jop7ns0r.cn
鸡屎藤和什么相克hcv9jop4ns4r.cn 尿多是什么病hcv8jop3ns7r.cn 吃花生有什么好处hcv8jop3ns1r.cn 足及念什么hcv8jop0ns3r.cn 什么玉最好有灵性养人hcv8jop4ns9r.cn
属蛇是什么命hcv9jop4ns3r.cn 蜱虫的天敌是什么hcv9jop6ns5r.cn 心存善念是什么意思hcv8jop1ns8r.cn 办护照需要准备什么材料hcv8jop8ns7r.cn 四月初八是什么日子hcv8jop4ns0r.cn
百度