Help:Transclusion

From Swordschool
Jump to navigationJump to search

Transclusion is generally the inclusion of the content of a document into another document by reference. In a Wikipedia context, it is the use of the template functionality of MediaWiki to include the same content in multiple documents without having to edit those documents separately. Template transclusion is the common way to use template messages, and is implemented by using a template tag, with the form:

{{template name}}

Occasionally one may want to use a template, but for one reason or another may not want to use transclusion. The automatic one-time copying of a template's code/text to the location of a template tag is called Template substitution or subclusion (substitution + transclusion). To subclude a template's code/text, the template tag is modified from the standard transclusion tag to a substitution tag, simply by adding subst:, creating a tag with the form: {{subst:template name}}.

How transclusion works

To transclude any source page (within a single MediaWiki project, such as en:Wikipedia) within another target page, include the following code:

{{SOMEPAGE}}

Whenever the target page A with this code is rendered, the engine will include in that place not the code itself, but the entire content of the source page B, SOMEPAGE.

For example, you might decide to place a welcome message on every newcomer's Talk Page. Transclusion creates a "live" link between the template-page and the target-page(s) upon which the message should appear. When the template is edited, all the target-pages are edited too.

For example, you might decide to create a (template) page with your mailing address and include that template on not only your page, but all your friends' pages, too. When you move your television and couch to another apartment, you will change your address template, and automatically, that new information will appear on all your friends' pages.

Etymology

Ted Nelson coined the term "transclusion," as well as "hypertext" and "hypermedia", in his 1982 book, Literary Machines.

Partial transclusion

By using "noinclude", "onlyinclude" and "includeonly" markup, it is possible to transclude part of a page rather than all of it. Such partial transclusions can also be achieved by transcluding from other pages such as subpages. It is often useful not to transclude some information, such as template documentation.

For an example of how this technique can be applied to simplify the creation of summary articles, see [1], which consisted of a collection of transcluded lead paragraphs from several main articles.

Transclusion markup

  • noinclude. The markup <noinclude>...</noinclude> means that the text between the tags will not be transcluded onto another page, but will only appear on the page itself. This is useful for documentation.
  • includeonly. The markup <includeonly>...</includeonly> means that the text between the tags will only be used when the page is transcluded onto another page, and will not appear on the page itself. This can be useful, for example, for adding categories to pages transcluding a template, without adding the template itself to these categories.
  • onlyinclude. The markup <onlyinclude>...</onlyinclude> indicates that only text surrounded by "onlyinclude" markup should be transcluded onto another page. This is the most subtle of the partial transclusion tags because it often overrules the others. If there is at least one pair of "onlyinclude" tags on a page, then whenever this page is transcluded, it is only the material within the "onlyinclude" tags which gets transcluded. There can be several such sections, and within each such section, some material might be further excluded by "noinclude" tags, and might also be surrounded by "includeonly" tags so that it does not appear on the original page itself. But material outside the "onlyinclude" tags will be ignored when the page is transcluded onto another page. This can be useful, for example, to repeat a small part of one page on a second one: just surround the small part by onlyinclude tags, and transclude it onto the second page.

Subpages

One can cut and paste the text to be transcluded into a subpage, then use the name of the subpage in the transclusion template. This approach can only be used with subpages from User, Talk or Wikipedia pages; currently, subpages cannot be created from main article pages.

Example: you want to discuss the deletion and redirecting of Pussycat to Cat. First, create the subpage Talk:Pussycat/Let's delete Pussycat!, write your comment into it, then transclude it in Talk:Pussycat and Talk:Cat using the template {{Talk:Pussycat/Let's delete Pussycat!}}. Comments posted in either talk page will be shown in both.

Special pages

See also:w:Wikipedia:Special pages#Miscellaneous

Some pages on Special:Specialpages can be transcluded, e.g. Special:Newpages

Sample: {{Special:Newpages/3}} gives 3 new pages.

Alternatives to transclusion by template

Labeled Section Transclusion

An extension called Labeled Section Transclusion enables marked sections of text to be transcluded. An extension with a somewhat similar function is PageVariableExtension.

Semantic MediaWiki

The Semantic MediaWiki extension uses inline queries to query and display semantic data. There are currently two ways to perform transclusion or something similar:

  1. Transclusion proper. The display format "embedded" ensures that selected pages (mainspace articles, templates, etc.) are transcluded. As with templates, sections placed between noinclude tags will be omitted.
  2. Selected passages in a page can be assigned a property of type 'Text' so that they are stored as plain text (note that they cannot contain internal or external links). These selections can be requested by running an inline query for this type of property.

See http://semantic-mediawiki.org/wiki/Help:Inline_queries for further information.

Pages related to MediaWiki transclusion

Templates

See also

fa:ویکی‌پدیا:تراگنجانش fr:Wikipédia:Inclusion ko:위키백과:문서 끼워넣기 yi:װיקיפּעדיע:אריינשטעלן zh:Wikipedia:嵌入包含 pt:Wikipedia:Predefinições

{{#if:{{#switch:Transclusion |=Languages: |Languages=Languages: |MediaWiki=Languages: |af=Taal: |aln=Gjuha: |am=ቋምቋ፦ |an=Idioma: |ang=Sprǣc: |ar=:اللغة |arc=ܠܫܢܐ: |arn=Dungun: |arz=:اللغة |as=ভাষা: |ast=Llingua: |avk=Ava: |ay=Aru: |az=Dil: |bat-smg=Kalba: |bcc=:زبان |bcl=Tataramon: |be=Мова: |be-tarask=Мова: |bg=Език: |bn=ভাষা: |br=Yezh : |bs=Jezik: |ca=Llengua: |cdo=Ngṳ̄-ngiòng: |ce=Мотт: |ceb=Pinulongan: |ch=Lengguahe: |ckb-arab=:زمان |co=Lingua: |crh-cyrl=Тиль: |crh-latn=Til: |cs=Jazyk: |cu=ѩꙁꙑ́къ : |cv=Чĕлхе: |cy=Iaith: |da=Sprog: |de=Sprache: |diq=Zıwan: |dsb=Rěc: |ee=Gbe: |el=Γλώσσα: |en=Language: |eo=Lingvo: |es=Idioma: |et=Keel: |eu=Hizkuntza: |ext=Palra: |fa=:زبان |fi=Kieli: |fo=Mál: |fr=Langue: |frc=Langue: |frp=Lengoua: |fur=Lenghe: |fy=Taal: |ga=Teanga: |gag=Dil: |gan-hans=语言: |gan-hant=語言: |gl=Lingua: |gn=Ñe'ẽ: |got=Razda: |grc=Γλῶσσα: |gsw=Sproch: |gu=ભાષા: |gv=Çhengey: |hak=Ngî-ngièn: |haw=Kou 'ōlelo: |he=שפה: |hi=भाषा: |hif-latn=Bhasa: |hr=Jezik: |hsb=Rěč: |ht=Lang: |hu=Nyelv: |hy=Լեզու. |ia=Lingua: |id=Bahasa: |ie=Lingue: |ilo=Lengguahe: |io=Linguo: |is=Tungumál: |it=Lingua: |ja=言語: |jv=Basa: |ka=ენა: |kaa=Til: |kab=Tutlayt: |kg=Ndinga: |kiu=Zon: |kk-arab=:ٴتىل |kk-cyrl=Тіл: |kk-latn=Til: |km=ភាសា៖ |kn=ಭಾಷೆ: |ko=언어: |ksh=Sproch: |ku-latn=Ziman: |kv=Кыв: |kw=Yeth: |ky=Тил: |la=Lingua: |lb=Sprooch: |lfn=Lingua: |li=Taol: |lij=Lengoa: |loz=Zwa Siselect: |lt=Kalba: |lv=Valoda: |lzh=語: |mdf=Кяль: |mg=fiteny: |mhr=Йылме: |mk=Јазик: |ml=ഭാഷ: |mn=Хэл: |mr=भाषा: |ms=Bahasa: |mt=Lingwa: |mwl=Lhéngua: |my=ဘာသာ: |myv=Кель: |nah=Tlahtōlli: |nap=Lengua: |nds=Spraak: |nds-nl=Taal: |ne=भाषा: |new=भाषा: |nl=Taal: |nn=Språk: |no=Språk: |nso=Polelo: |oc=Lenga: |os=Æвзаг: |pa=ਭਾਸ਼ਾ: |pam=Amanu: |pdc=Schprooch: |pdt=Sproak: |pl=Język: |pms=Lenga: |pnb=بولی: |pnt=Γλώσσαν: |prg=Bilā: |ps=ژبه: |pt|pt-br=Língua: |qu=Rimay: |rm=Lingua: |ro=Limba: |roa-tara=Lénga: |ru=Язык: |sa=भाषा: |sah=Омугун тыла: |sc=Limba: |scn=Lingua: |sco=Leid: |sdc=Linga: |se=Giella: |sei=Itom: |sh=Jezik: |shi=tutlayt: |si=භාෂාව: |sk=Jazyk: |sl=Jezik: |sli=Sproache: |so=Luqada: |sq=Gjuha: |sr-ec=Језик: |sr-el=Jezik: |srn=Tongo: |ss=Lúlwîmi: |stq=Sproake: |su=Basa: |sv=Språk: |sw=Lugha: |szl=Godka: |ta=மொழி: |te=భాష: |tet=Lian: |tg-cyrl=Забон: |th=ภาษา: |ti=ቋንቋ: |tk=Dil: |tl=Wika: |to=Lea: |tr=Dil: |tt-cyrl=Тел: |tyv=Дыл: |ug-arab=:تىل |ug-latn=Til: |uk=Мова: |vec=Lengua: |vep=Kel’: |vi=Ngôn ngữ: |vo=Pük: |vro=Kiil: |wa=Lingaedje: |war=Yinaknan: |wo=Làkk: |wuu=语言: |xal=Келн: |xh=Ulwimi: |xmf=ნინა: |yi=שפראך: |yo=Èdè: |yue=語言: |zea=Taele: |zh-hans=语言: |zh-hant=語言: |zu=Ulimi: |#default=Language: }} | |

}}

{{#switch:Transclusion |=Languages: |Languages=Languages: |MediaWiki=Languages: |af=Taal: |aln=Gjuha: |am=ቋምቋ፦ |an=Idioma: |ang=Sprǣc: |ar=:اللغة |arc=ܠܫܢܐ: |arn=Dungun: |arz=:اللغة |as=ভাষা: |ast=Llingua: |avk=Ava: |ay=Aru: |az=Dil: |bat-smg=Kalba: |bcc=:زبان |bcl=Tataramon: |be=Мова: |be-tarask=Мова: |bg=Език: |bn=ভাষা: |br=Yezh : |bs=Jezik: |ca=Llengua: |cdo=Ngṳ̄-ngiòng: |ce=Мотт: |ceb=Pinulongan: |ch=Lengguahe: |ckb-arab=:زمان |co=Lingua: |crh-cyrl=Тиль: |crh-latn=Til: |cs=Jazyk: |cu=ѩꙁꙑ́къ : |cv=Чĕлхе: |cy=Iaith: |da=Sprog: |de=Sprache: |diq=Zıwan: |dsb=Rěc: |ee=Gbe: |el=Γλώσσα: |en=Language: |eo=Lingvo: |es=Idioma: |et=Keel: |eu=Hizkuntza: |ext=Palra: |fa=:زبان |fi=Kieli: |fo=Mál: |fr=Langue: |frc=Langue: |frp=Lengoua: |fur=Lenghe: |fy=Taal: |ga=Teanga: |gag=Dil: |gan-hans=语言: |gan-hant=語言: |gl=Lingua: |gn=Ñe'ẽ: |got=Razda: |grc=Γλῶσσα: |gsw=Sproch: |gu=ભાષા: |gv=Çhengey: |hak=Ngî-ngièn: |haw=Kou 'ōlelo: |he=שפה: |hi=भाषा: |hif-latn=Bhasa: |hr=Jezik: |hsb=Rěč: |ht=Lang: |hu=Nyelv: |hy=Լեզու. |ia=Lingua: |id=Bahasa: |ie=Lingue: |ilo=Lengguahe: |io=Linguo: |is=Tungumál: |it=Lingua: |ja=言語: |jv=Basa: |ka=ენა: |kaa=Til: |kab=Tutlayt: |kg=Ndinga: |kiu=Zon: |kk-arab=:ٴتىل |kk-cyrl=Тіл: |kk-latn=Til: |km=ភាសា៖ |kn=ಭಾಷೆ: |ko=언어: |ksh=Sproch: |ku-latn=Ziman: |kv=Кыв: |kw=Yeth: |ky=Тил: |la=Lingua: |lb=Sprooch: |lfn=Lingua: |li=Taol: |lij=Lengoa: |loz=Zwa Siselect: |lt=Kalba: |lv=Valoda: |lzh=語: |mdf=Кяль: |mg=fiteny: |mhr=Йылме: |mk=Јазик: |ml=ഭാഷ: |mn=Хэл: |mr=भाषा: |ms=Bahasa: |mt=Lingwa: |mwl=Lhéngua: |my=ဘာသာ: |myv=Кель: |nah=Tlahtōlli: |nap=Lengua: |nds=Spraak: |nds-nl=Taal: |ne=भाषा: |new=भाषा: |nl=Taal: |nn=Språk: |no=Språk: |nso=Polelo: |oc=Lenga: |os=Æвзаг: |pa=ਭਾਸ਼ਾ: |pam=Amanu: |pdc=Schprooch: |pdt=Sproak: |pl=Język: |pms=Lenga: |pnb=بولی: |pnt=Γλώσσαν: |prg=Bilā: |ps=ژبه: |pt|pt-br=Língua: |qu=Rimay: |rm=Lingua: |ro=Limba: |roa-tara=Lénga: |ru=Язык: |sa=भाषा: |sah=Омугун тыла: |sc=Limba: |scn=Lingua: |sco=Leid: |sdc=Linga: |se=Giella: |sei=Itom: |sh=Jezik: |shi=tutlayt: |si=භාෂාව: |sk=Jazyk: |sl=Jezik: |sli=Sproache: |so=Luqada: |sq=Gjuha: |sr-ec=Језик: |sr-el=Jezik: |srn=Tongo: |ss=Lúlwîmi: |stq=Sproake: |su=Basa: |sv=Språk: |sw=Lugha: |szl=Godka: |ta=மொழி: |te=భాష: |tet=Lian: |tg-cyrl=Забон: |th=ภาษา: |ti=ቋንቋ: |tk=Dil: |tl=Wika: |to=Lea: |tr=Dil: |tt-cyrl=Тел: |tyv=Дыл: |ug-arab=:تىل |ug-latn=Til: |uk=Мова: |vec=Lengua: |vep=Kel’: |vi=Ngôn ngữ: |vo=Pük: |vro=Kiil: |wa=Lingaedje: |war=Yinaknan: |wo=Làkk: |wuu=语言: |xal=Келн: |xh=Ulwimi: |xmf=ნინა: |yi=שפראך: |yo=Èdè: |yue=語言: |zea=Taele: |zh-hans=语言: |zh-hant=語言: |zu=Ulimi: |#default=Language: }} English {{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/af |  • {{#if: |Afrikaans| Afrikaans}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ar |  • {{#if: |العربية| العربية}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ast |  • {{#if: |asturianu| asturianu}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/az |  • {{#if: |azərbaycanca| azərbaycanca}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/bcc |  • {{#if: |جهلسری بلوچی| جهلسری بلوچی}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/bg |  • {{#if: |български| български}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/br |  • {{#if: |brezhoneg| brezhoneg}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ca |  • {{#if: |català| català}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/cs |  • {{#if: |čeština| čeština}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/da |  • {{#if: |dansk| dansk}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/de |  • {{#if: |Deutsch| Deutsch}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/el |  • {{#if: |Ελληνικά| Ελληνικά}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/eo |  • {{#if: |Esperanto| Esperanto}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/es |  • {{#if: |español| español}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/fa |  • {{#if: |فارسی| فارسی}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/fi |  • {{#if: |suomi| suomi}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/fr |  • {{#if: |français| français}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/gl |  • {{#if: |galego| galego}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/gu |  • {{#if: |ગુજરાતી| ગુજરાતી}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/he |  • {{#if: |עברית| עברית}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/hu |  • {{#if: |magyar| magyar}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/id |  • {{#if: |Bahasa Indonesia| Bahasa Indonesia}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/it |  • {{#if: |italiano| italiano}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ja |  • {{#if: |日本語| 日本語}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ka |  • {{#if: |ქართული| ქართული}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ko |  • {{#if: |한국어| 한국어}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ksh |  • {{#if: |Ripoarisch| Ripoarisch}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/kw |  • {{#if: |kernowek| kernowek}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/mk |  • {{#if: |македонски| македонски}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ml |  • {{#if: |മലയാളം| മലയാളം}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/mr |  • {{#if: |मराठी| मराठी}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ms |  • {{#if: |Bahasa Melayu| Bahasa Melayu}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/nl |  • {{#if: |Nederlands| Nederlands}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/no |  • {{#if: |norsk| norsk}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/oc |  • {{#if: |occitan| occitan}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/pl |  • {{#if: |polski| polski}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/pt |  • {{#if: |português| português}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/pt-br |  • {{#if: |português do Brasil| português do Brasil}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ro |  • {{#if: |română| română}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ru |  • {{#if: |русский| русский}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/si |  • {{#if: |සිංහල| සිංහල}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/sk |  • {{#if: |slovenčina| slovenčina}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/sq |  • {{#if: |shqip| shqip}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/sr |  • {{#if: |српски / srpski| српски / srpski}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/sv |  • {{#if: |svenska| svenska}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ta |  • {{#if: |தமிழ்| தமிழ்}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/th |  • {{#if: |ไทย| ไทย}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/tr |  • {{#if: |Türkçe| Türkçe}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/uk |  • {{#if: |українська| українська}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/vi |  • {{#if: |Tiếng Việt| Tiếng Việt}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/yue |  • {{#if: |粵語| 粵語}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/zh |  • {{#if: |中文| 中文}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/zh-hans |  • {{#if: |中文(简体)‎| 中文(简体)‎}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/zh-hant |  • {{#if: |中文(繁體)‎| 中文(繁體)‎}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/zh-tw |  • {{#if: |中文(台灣)‎| 中文(台灣)‎}}|}}