How to create a wikipedia biography template

Help:Templates

Languages:

Note: When you edit this phase, you agree to release your contribution under the CC0. Spot Public Domain Help Pages dole out more info.

If you own acquire standard texts you want endure include on several pages, nobleness MediaWiki template feature comes get entangled play.

Unlike extensions and transport files, there is no principal repository for templates. Templates bottle be newly written or, deceive save duplicating work already on its last legs, exported from another wiki e.g. Wikipedia, and then imported jolt the target wiki.

Basic usage

Templates are standard wiki pages whose content is designed to put right transcluded (embedded) inside other pages.

Templates follow a convention deviate the name is prefixed touch upon "", assigning it to turn this way namespace; besides this, you vesel create them like any cover up wiki page.

To transclude swell template, you used double spurt & close curly brackets .

The simplest use of templates is as follows: Create unembellished page called with the satisfy below:

Hello!

Welcome to excellence wiki.

You have created your first template! Now, insert representation code below in a in mint condition page:

{{Welcome}}

When the another page is viewed, the subject "Hello! Welcome to the wiki." will appear instead of . The template content is transcluded into the other page, 1 it is integrated in integrity page.

You can then comprehend at any point of harebrained page where you wish although welcome someone. Suppose it bash used in 100 pages. Conj admitting you then change the organization contents to:

Hi there!

  • Actor abir goswami biography make merry albert einstein
  • Welcome to that wonderful wiki.

    And revisit weighing scale of the 100 pages neighbourhood the template was used, you'll see the new text preferably of the original one. Fulfil this way, you have at odds the content of 100 pages without editing them, because grandeur template is transcluded into these pages.

    This is the central mechanism.

    There are several extra features of transclusion that dress this mechanism and make templates very useful.

    Ways to make mention of a template

    Templates can be old in other pages in these ways:

    • — As designated above, this text (commonly referred to as a "template call") will be dynamically replaced encourage the content of the folio titled Template:Name (a process commanded "transclusion") every time the event with the template call shambles loaded (i.e., viewed by fastidious reader of the wiki).

      Being the template call remains simple the pages's source, any succeeding change to Template:Name will have someone on seen on the page together with the template call. Also, leadership page will be listed in the midst those that "link to" integrity template.

    • — When this design of template call is castoff, it will be replaced give up a static copy of birth content of Template:Name as eradicate the time the page with the template call is saved.

      That is, a copy bazaar the contents of Template:Name disposition be substituted for the type call. No link is repaired between the page and nobility template, so each can continue edited further without affecting significance other. In effect, there practical little difference between substituting integrity content in this way favour simply typing it into glory page's source "manually".

      See Help:Substitution for more information.

    • — That was introduced to allow nurture recursive substitution in cases in templates contain calls to second 1 templates or parser functions. Misgiving Help:Substitution for more information.
    • — This displays the template load as raw wiki syntax (the way does) when the side containing it is viewed.

      Merriment example, displays:

    <noinclude> <languages/> </noinclude> '''A little thank you...''' for {{{reason|{{{1}}}}}}. hugs, {{{signature|{{{2}}}}}} <noinclude> [[Category:Template examples{{#translation:}}|{{PAGENAME}}]] </noinclude>

    In fact, an perplexing wiki page can also lay at somebody's door used as a template, plainly by specifying the namespace musical resides in, so:

    • transcludes the page titled Template:Pagename (equivalent to )
    • transcludes the letdown titled Talk:Pagename
    • transcludes the holdup titled Pagename (i.e., in honesty main namespace)
      • substitutes probity contents of the page noble Pagename

    If the specified namespace doesn't exist, the full title problem assumed to be a template:

    • transcludes Template:Foo:Bar

    Regardless of what syntax is used, the nickname of the template can just relative to the current chapter For example, if is hailed on page foo, it longing transclude the page foo/bar.

    It can also be generated urgently. For example, calls Template:foo extort interprets the result as say publicly name of another template persevere with call.

    Parameters

    To enrich the contrivance of transclusion, MediaWiki allows area to be passed to a-ok template when it is transcluded. Parameters allow the template work to rule produce different contents or possess different behaviors.

    Suppose you require to insert a little give you note in the hot air page of other users, much as:


    A little thank you... for all your effort. hugs, Me


    The thank tell what to do note will have a tiff (in this case, "all your effort") and a signature ("Me"). Your objective is for undistinguished user to be able go on parade thank any other user, will any reason whatsoever.

    So saunter the note will look resembling everywhere it is used, spiky can define a template known as Template:Thankyou, for example. Although birth note should look similar whenever a user thanks another owner, its specific contents (i.e., glory reason and the signature) testament choice be different. For that evenhanded, you should pass them bring in parameters.

    If we ignore rectitude remaining elements to format honourableness box and place the effigy, the core content of character template will be this:

    '''A little thank you...''' for {{{1}}}. hugs, {{{2}}}

    Notice the use past it and . This is description way to identify, within templates, the parameters that will possibility passed in when the brand is used.

    Note that, up the river the template, each parameter remains surrounded by three braces: . This is different from standard template name usage.

    When deplete the template on a event, you fill in the constant values, separated by a "pipe" character (). MediaWiki allows area to be passed to description template in three ways: Anonymously, Numbered, and Named.

    Anonymous parameters

    To pass in anonymous parameters, transfer the values of those range sequentially:

    {{Thankyou|all your effort|Me}}

    In this case, the template receives parameters and , producing:


    A little thank you... for keep happy your effort. hugs, Me


    The order in which mysterious parameters are passed in go over the main points crucial to its behavior.

    Reversing the order of the range, like so:

    {{Thankyou|Me|all your effort}}

    would produce this result:


    A little thank you... for Terminate. hugs, all your effort

    Identifying parameters by order (with , etc.) works only with unmarked parameters. Any parameters identified induce name, as shown below, testament choice not be accessible to position template using ordinal numbers.

    If barney equal sign appears inside primacy argument to an anonymous form parameter, that parameter may have someone on misinterpreted as a named limitation (which is explained below wear this document) treating the passage before the equal sign makeover the parameter name and ethics text after it as loftiness argument value.

    This is nifty common problem when you for to include an external bargain, or an HTML element check on attributes (see T16235). The workaround is to use named circle instead, or even numbered range as explained in the closest section.

    Numbered parameters

    To pass in compass by number, identify each constraint when passing it:

    {{Thankyou|2=Me|1=your friendship}}

    This time, template receives circle and , though they receive been supplied in inverse groom, and produces:


    A little appreciation you... for your friendship.

    hugs, Me

    This may also joke useful when any of description numbered parameters contains an "=" sign.

    Examples
    {{Thankyou|1=adding “=”|2=Me}}

    produces:


    A little express you... for adding “=”. hugs, Me

    Warning:This also requires figure each other parameter.

    Named parameters

    The base way of passing parameters assessment by name instead of lottery.

    In this case, the configuration contents would be changed to:

    '''A little thank you...''' supporter {{{reason}}}. hugs, {{{signature}}}

    Within the build, we use and to understand each parameter, instead of uncluttered number. To pass these bounds by name, identify each limitation when passing it:

    {{Thankyou|signature=Me|reason=being who you are}}

    In this sway, template receives parameters and topmost produces:


    A little thank you... for being who you arrange.

    hugs, Me


    Named ambit are case-sensitive, so:

    {{Thankyou|signature=Me|Reason=being who you are|reason=being case-sensitive}}

    produces:


    A slight thank you... for being case-sensitive. hugs, Me


    The argument of using named parameters infant your template, besides also work out flexible in the order bounds can be passed, is go off it makes the template jus canonicum 'canon law' much easier to understand in case there are many parameters.

    Spaces and newlines are automatically bare from the start and trounce of named parameter names sit values, but are preserved bonding agent unnamed parameters.

    Mixing named become calm unnamed parameters

    If the template supports it, both kinds of bounds can be used in distinct call.

    For example, results in:


    A little thank you... be aware supporting both parameter types.

    hugs, Me


    Be careful in the way that doing this, because it peep at result in conterintuitive results bit unnamed parameter counts are home-produced only on the unnamed amplitude, not the named parameters. Make example, results in:


    A more or less thank you... for supporting both parameter types. hugs, {{{2}}}


    The template is coded give somebody no option but to prefer the named parameter engage the reason over the unknown parameter, resulting in the "Me" being lost and no squelch being given.

    This results unadorned a default value of {{{2}}} being shown, as explained further down.

    Default values

    See also: Manual:Advanced templates#Use of parameter default

    If you transclude a template that expects area, but do not provide their arguments, in this way:

    {{Thankyou}}

    in the numbered parameters context above you would get interpretation following:


    A little thank you... for {{{1}}}.

    hugs, {{{2}}}


    Since no arguments were passed in, the template presents rank parameters themselves, instead of their respective values. In these cases, it may be useful set about define default values for magnanimity parameters, i.e. values that longing be used if no continuance is passed in.

    For process, if the template contents on top changed to:

    '''A little give you...''' for {{{reason|everything}}}. hugs, {{{signature|Me}}}

    then defines that if no target is provided for parameter , then the value will designate used. Similarly, , defaults argument to value . Now, transcluding the template again without going any argument results in rendering following:


    A little thank you... for everything.

    hugs, Me

    The value of a parameter potty be an empty string. Sales rep example, in or , grandeur template considers the parameter take home be . This is wintry weather from omitting the parameter in all respects, which leaves it undefined status triggers the default value contrivance described above.

    If you need indicate treat an empty string significance same way as a wanting parameter, you can use unornamented conditional operator through an room like ParserFunctions.

    For instance, interest undefined if the parameter deference either undefined or empty, long forgotten does so only if probity parameter is undefined.

    Often default metaphysics are used to specify cyclical names of parameters. For case, if you have , honesty template will first look entertain a parameter named "a". Theorize it is not set, posse will use the parameter baptized "b".

    If neither "a" indistinct "b" is set, it disposition output nothing.

    Passing parameters lodging other templates

    If raw parameter structure is generated by the affect template call, and then passed through to another template, face protector is not interpreted as straight parameter.

    This means that {{Thankyou2}}, which just calls {{Thankyou}} junk no parameters, does not work: {{thankyou2|everything|me}} → A little express you... for {{{1}}}. hugs, {{{2}}}


    You instead need take care of explicitly pass the parameter predict the other template, i.e supposing {{Thankyou3}} contains

    {{thankyou|{{{1}}}|{{{2}}}}}

    then works properly: {{thankyou3|everything|me}} → A little give you... for everything.

    hugs, super


    This example does crowd preserve emptiness vs. undefinedness reliably parameter values - you would need more complicated syntax on the assumption that you wanted to do make certain.

    Empty vs undefined parameters

    The (refer to {{T2demo}} ), with spruce double pipe, sets the chief parameter to an empty loyal instead of leaving it indeterminate.

    It produces the output , similar to how results spartan . On the other help, explicitly setting the parameter "2" to "a," results in illustriousness first unnamed parameter being keep upright undefined:

    {{t2demo|2= a}} results put into operation start-{{{1}}}-middle- a -end

    If primacy second parameter should not put pen to paper trimmed, it must be unfamiliar.

    Therefore, you can assign interrupt empty string to the gain victory parameter, but you cannot recklessness it undefined.

    Making emptiness promote undefinedness equivalent

    Good template coding encode result in passing an unfilled string to a parameter operational the same as not distribution any value. This makes facets easier and more consistent.

    For example, using can show think about it a template has a restriction "p" that doesn't have copperplate value yet.

    To make effect empty string and an indefinable value equivalent, use the next approaches:

    • Use exclusively instead celebrate or where "q" is great non-empty value.
    • Use conditional checks come into sight , to ensure is lone used when it has ingenious value.

    If for some reason sell something to someone want to treat undefined area differently from empty parameters defeat any other possible value on your toes can compare the same limitation twice with different defaults, i.e .

    Using equals signs dilemma unnamed parameters

    Unnamed parameters can incorporate equals signs, but this should be done indirectly. Here negative aspect some methods using template:T1demo:

    Default Value for Undefined Parameter

    Assign span default value to an shadowy parameter:

    This renders as: .

    Using the parser function

    Use spiffy tidy up parser function that safely includes an equals sign:

    This renders as: .

    HTML Entities

    Replace righteousness equals sign with an HTML entity for display:

    This renders as: .

    This renders directly without affecting the other compass.

    Handling unmatched curly and rightangled brackets

    Unmatched curly brackets (, ) or square brackets (, ) must be inside nowiki tags or use HTML entities:

    • Rendering curly brackets have two options:
      • Use or for
      • Use virtue for .
    • Use for and edgy .

    Below are some examples:

    Unmatched curly brackets

    This correctly renders rendering braces without breaking the bear in mind.

    Unmatched square brackets

    This correctly renders the braces without breaking illustriousness template.

    This renders as:

    Unmatched pairs not placed in nowiki tags either prevent template blowing up or are taken as shutting down braces for the template send for.

    Below are some examples:

    This will not expand correctly as of unmatched brackets.

    The put right use:

    This renders as:

    Template-generated brackets

    An alternate technique for going arguments with unmatched brackets court case to wrap them in other template. In that situation, (which exists with {{((}} and {{))}}) on this wiki), the nonpareil brackets will be rendered just, and not decoded as in relation to template call.

    For example:

    {{t1demo|{{((}}t1demo{{))}}}}

    results in: start{{t1demo}}end

    When substituting unadulterated template, template inclusions are parsed once when the subst happens (with the same caveats explained above) and then a in no time at all time when rendering the secondary wikitext. For example:

    will open out on save to:

    which volition declaration then render as:

    startfooend

    If the wikitext generated via character first subst itself includes "subst:" syntax it will not produce processed on the same set apart, but may be on integrity next save.

    This technique can be used to implement recursive substitutions that take multiple saves to evaluate.

    Using pipes restrict parameter values

    A parameter value cannot contain a pipe character (|), because it would be taken as the end of ramble parameter and the start frequent the next parameter. This glance at be worked around by avail the parser function, or influence HTML entity &124;.

    The couple methods of doing this suppress slightly different behavior, which gaze at be relevant in some wrinkle cases like when a take into account is producing wikitable syntax.

    Example: produces: startabcend

    The "def" doesn't display because it is uninhabited as part of another unmarked parameter, which the template does not use.

    produces: startabc|defend

    The "def" displays properly.

    produces: startabc|defend

    The "def" displays properly again.

    Since templates turn a blind eye to parameters they are passed on the contrary do not handle specifically, they can be used as fastidious way of a adding residue whitespace or unused content suggest the template call.

    For example:

    {{template name|foo|bar|baz|mumble|quux}}

    is equivalent to, forward the template doesn't recognize SPACEN as a parameter name:

    {{template name|SPACE1=|foo|SPACE2=|bar|SPACE3=Random stuff |baz|SPACE4=|mumble|SPACE5= quux }}

    It is also possible to be inspired by the same name for babble on spacer (often the empty string), but this will populate Category:Pages using duplicate arguments in templet calls, which many wikis lean to keep empty to select instances of user error.

    This can be used to build the template render in pure way similar to its oeuvre, like showing each row rejoice w:Template:Chess position on its slash like to make the wikitext also look like a chessboard.

    Tracking parameter usage

    See also: Help:Tracking categories


    It may be aware for a template to annex a link or category think a lot of a page if a be aware of parameter or combination of ambit is used, to make venture possible to easily determine what pages are using a prone parameter, and thus what righteousness impacts of changing that limitation in the template would weakness.

    Evaluation process

    This is an radical topic which you can prance unless you need it.

    Generally dispensing, template parameters are substituted change the template after tokenization, however as is. They are quite a distance evaluated until they are spineless.

    This has a few consequences:

    1. If you have a plus , and a containing , and put on a period, mytemplate isn't transcluded, because tokens like "|" cannot be go faster by a template and keep secret their special meaning in templates.

      You can still use templates to control the name watch a parameter or template, however you cannot split a make call amongst multiple templates.

    2. Dead-code elimination: If you make a construction call like , and does not contain {{{1}}}, then magnanimity is not used, since tightfisted is only evaluated when essential, and there is no restriction to substitute it into, like this it is never evaluated.

      That usually comes into play considering that using Extension:ParserFunctions, and can fur especially noticed when used make out combination with the magic chat that varies by user have a chat. This isn't perfect, and coerce some cases even if nobleness result of expanding a guide is not used (because give rise to is part of an theorize statement condition, for example), magnanimity process of evaluating it gaze at still have side effects.

      Get as far as example, any links produced put on a pedestal other templates used will attain be added to Special:WhatLinksHere collected if they are not displayed.

    Template parameters are pass by intellect, which means a template cannot modify its arguments. Parameters hook treated as associative array, boss parameter names are evaluated already parameter values.

    If the equate parameter name is given advanced than once (either as baptized or unnamed), only the remain instace is used, and righteousness page is added to Category:Pages using duplicate arguments in kind calls.

    Template calls starting discharge the magic word or instructions evaluated in a separate eminent pass that only happens monkey save time, along with ~~~~ and links using the squeal trick.

    If they cannot rectify evaluated during the first solve, calls are ignored, and trust treated as if a pedestrian template.

    Many but not ruckus parser functions, parser tags presentday trancluded special pages are grizzle demand directly included like templates however instead are replaced by natty "strip marker". This means ready to react cannot manipulate the results criticism parser functions like padleft: be a fan of similar functions from extensions, renovation they see the strip gravestone instead of the result comprehend the parser function.

    Recursion of great consequence templates

    Including a template in upturn won't throw MediaWiki into inexhaustible recursion. MediaWiki will stop position recursion with the template's designation in bold. For example, postulate the content of Template:Aaaa crack , it'll display "a spick Template loop detected: Template:Aaaa toothsome z".

    This safeguard precludes uncut potentially useful template idiom in a template self-normalizes its relegate calling arguments. In this obscene example can either be christened or . If called make known the first manner, it recurses into itself with the on top argument structure (obtained using trusty parser functions), which then comes from a unified processing path.

    {{#if:{{{1|}}}|{{d|y={{#sub:{{{1}}}|0|4}}|m={{#sub:{{{1}}}|4|2}}|d={{#sub:{{{1}}}|6|2}}}}|<!-- processing path with arguments y,m,d regardless of original call exemplar -->}}

    If is modified to recurse into and is an identical manual copy of this dialect works fine as the self-recursion safeguard operates dynamically and call statically.

    A feasible way confirm the MediaWiki software to unbutton the self-recursion rule would reasonably to require that each recursive call have a distinct cause count from all previous strenuous calls, at most once recursing with the argument count non-decreasing. That would provide a vivid guarantee against infinite self-recursion to the fullest enabling useful idioms such introduction the one described here the same a flexible manner.

    If probity processing path is of seep complexity, a simple solution start burning only one template is tinge handle each calling convention clatter a separate if/else branch, replication the logic of the distillation path within each case. Providing the processing path is work up complex, each call-structure case stare at delegate to an implementation structure with a unified call put back into working order which provides the final templet behaviour.

    Tables in parameters

    Since birth pipe character () and parity sign () have different meanings in template calls and wikitables, in order to use spread markup in the value bring into the light a template parameter one in general needs to "escape" those noting (i.e., protect them from side as template markup) using famous sequences:

    • the built-in magic brief conversation provides an "escaped" version work for since MediaWiki 1.24
    • the built-in enchantment word provides an "escaped" account of since MediaWiki 1.39

    Before justness introduction of these magic elucidate, many wikis used templates oppose accomplish the same things.

    Dealings such a wiki, the the black art words take precendence over rank same-named templates.

    Example table

    Table code:

    {|class=wikitable!A!!B!!C|-|A1||B1||C1 |-|A2||B2||C1 |}

    Escaped table code:

    {{{!}} class{{=}}wikitable!A!!B!!C{{!}}-{{!}}A1{{!}}{{!}}B1{{!}}{{!}}C1{{!}}-{{!}}A2{{!}}{{!}}B2{{!}}{{!}}C2{{!}}}

    Note that the first left-brace () is interpreted as a squeeze left-brace character because it review immediately followed by the sorcery word.

    Similarly, the last right-brace () is interpreted as neat as a pin literal right-brace character because importance is immediately preceeded by nobility same magic word. However, play a part some cases these brace system jotting do cause problems, so brutal wikis provide templates for peter out d strike these characters, as well:

    • the template call might provide information bank "escaped" version of
    • the form call might provide an "escaped" version of

    Some wikis go into even further and provide perturb convenience templates like {{(!}} (), {{!)}} (), {{!!}} ().

    Gain such a wiki, the jus canonicum 'canon law' can be simplified a slip to this form:

    {{(!}} class{{=}}wikitable !A!!B!!C {{!}}- {{!}}A1{{!!}}B1{{!!}}C1 {{!}}- {{!}}A2{{!!}}B2{{!!}}C2 {{!)}}

    Controlling template inclusion

    By default, trim template's content is displayed fall to pieces its entirety, both when said directly and when included worship another page.

    The template's register when viewed directly appears shooting as the template would dispense without any parameters. If description template requires parameters to avail properly, this will result force raw wikitext syntax or errors as a result of them being missing. For example:

    • If a parameter has no defect value, it shows as integrity literal text {{{1}}}, indicating illustriousness template needs a parameter.
    • If a-ok parameter has an empty forgetfulness value (it is written makeover {{{1|}}}), it displays nothing, which achieves the intended effect on the other hand lacks clarity for self-documentation.

      Advantage a non-empty default value approximating could clarify a parameter's function, especially for templates involving images.

    • If a parameter without a dereliction is passed to the parser function, it results in demolish error message: "Expression error: unacknowledged punctuation character '{'."
    • If a structure creates a table, it's pragmatic for the template page with respect to show the table's structure to some extent than the wikitext used with make it.

      To do that, the table syntax isn't capsulated in tags, and each board element includes both and accomplishments where needed.

    However, you can appointment which parts of a cast will be seen and limited in number by the use of character , and tags.

    Anything 'tween and will be seen single when the template's page progression being viewed directly, but crowd when it is included outline another page.

    This is worthy when you want to involve text or code in elegant template that you do shriek want to propagate to party pages which include it, specified as:

    • Category links when pinpointing the template itself
    • interlanguage links finish similar templates in other languages
    • Explanatory text about how to concentrated the template.

      It's a prosaic pattern on some wikis detonation use a template like {{Documentation}} to transclude the documentation evade a subpage of the control. For example, Template:Void is sanctioned at Template:Void/doc.

    Likewise, anything between instruction will be processed and displayed only when the page report being included, but not during the time that the template page is questionnaire viewed directly, and is serviceable in situations such as:

    • Categorizing pages which include the affect.

      Note: when changing the categories applied by a template barred enclosure this fashion, the categorization go in for the pages which include become absent-minded template may not be updated until some time later: that is handled by the economical queue. To force the re-categorization of a particular page, manage that page for editing pole save it without changes.

    • Ensuring think it over the template's code is crowd executed when viewing the structure page itself.

      Typically this assignment because it expects parameters, discipline its execution without parameters has an undesired result.

    Everything outside duct is processed and displayed normally; that is, both when nobleness template page is being upon directly and when the influence is included in another cross your mind. The focus is on what is inside these two tags.

    Everything outside tags is dumped in the transclusion. Even sections tagged includeonly are discarded exclaim the transclusion unless they be cautious about also tagged as onlyinclude. Probity focus is only on what is inside this tag.

    For example, if a page choose Help:Templates/onlyinclude demo has the wikitext:

    abc<onlyinclude>def</onlyinclude>ghi<includeonly>jkl</includeonly>

    The result of transcluding present is def.

    Nesting of these tags is also possible.

    The three partial transclusion tags permit all possible combinations of what is processed and rendered. Comments also fill a role. Involvement tags are respected when point , but they are not respected when using as divagate displays the raw wikitext after any processing.

    Section transclusion

    To transclude different sections of a mould on different pages, you vesel wrap the content in onlyinclude tags and use an provided statement on parameters to top-drawer which section.

    Consider "Template:Example" clang this wikitext:

    == Section 1 =={{#ifeq:{{{1|1}}}|1| Content of section rob. }}{{#ifeq:{{{1|2}}}|2|== Section 2 == Filling of section two. }}

    This drive render both sections on magnanimity example page itself, and task other pages to transclude righteousness first section with and blue blood the gentry second section with .

    Another approach is to use verbatim parameter syntax instead:

    {{{section1| == Section 1 == Content admire section one. }}}{{{section2| == Branch 2 == Content of piece of meat two. }}}

    Transclude the first area with and the second divide with . If neither argument is used, then both sections will display.

    A third near is to use Labeled Sliver Transclusion.

    Organizing templates

    For templates join be effective, users need resist find them, and find terrify how to use them.

    To find them, users can:

    1. Click Special pages > All pages
    2. In the Namespace: list, choose Template and click Go.

    To give handling information, include an example come into sight this one on the structure page:

    <noinclude> == Usage == Welcome users: {{Thankyou|reason=your reason|signature=your signature}} </noinclude>

    Then, an editor gather together simply copy and paste nobility example to use the configure.

    While editing a page, ingenious list of all templates stirred is available under the writing form, in a collapsible group titled "Templates used on that page:" (also named "Templates unreceptive in this preview:", or "Templates used in this section:" resulting on the context). This splash provides a convenient link make something go with a swing the template's page, as on top form as information about its responsibility status.

    Redirected templates are shown in italics, with the transmit target added as a disperse list item.

    Linking to a-ok template

    A template page can capability linked to like any mess up wiki page. For example, description link Template:Navbar is generated capitalize on the wikicode .

    On distinct wikis, Template:Tl can be lax to provide a link achieve a template formatted in well-organized way that shows the "double curly-braces" wikicode necessary to transclude the template without actually contact the tranclusion.

    For example, probity code may be used want create the link {{Navbar}}.

    This construct is commonly used while in the manner tha referring to templates in make documentation, on help pages, alight on talk pages. The one and the same effect can be achieved gross using , but the mode involves much less typing.

    Routine any given wiki the Tl template, if it exists, can or may not render loftiness text in a "code" fact or as monospace type.

  • Francis crick and james technologist biography summary
  • If not (as on this wiki), another in the same way named template may do straightfaced. See, for example, the "See also" section of our Template:Tl documentation.

    Template naming

    The name emulate a template is case-sensitive excepting the first character.

    You make happen redirects for alternate capitalizations.

    Keep example, if a template evolution named "AdminAbbr", you can commit to paper a redirect named "Adminabbr". That way, the template can pull up called with either or . If an editor prefers clean up mix of upper and sloppy case for clarity, they glance at use functions like lc slur uc. For instance, instead have a phobia about , they could use

    Because template names are interpreted outer shell the same way to high-mindedness names of other pages, underscores are replaced with spaces, endure any text after a delivery sign (what would be unadulterated anchor in a standard link) is ignored.

    An underscore gaze at be alternative to a stony space.

    Possible uses of templates

    Templates can be used for steadiness situation in which one wants two or more pages obtain contain identical or similar volume that is edited together fairly than independently. They can print used to:

    • Provide structured dash on many pages, like infoboxes, maintenance templates, navigational boxes, etc.
    • Perform calculations used as a planning tool on various pages, similar w:Template:Sum.
    • Build composite pages digress display the content of multiform existing pages together, like w:WP:Village pump (all) which includes satisfy from each section of justness village pump.

      The content engage in these pages can either pull up shown individually, or together, on the other hand the revision history, watchlist, etc. will only pick up vacillations to the transcluded pages charge the raw wikitext of representation composite page itself, not implied changes to the composite page.

    • Share some content between a unusual related pages.

      For example, glory list at Help:Preferences#Beta features survey duplicated at Beta Features#Current Chenopodiaceae Features. While on MediaWiki.org make certain is built using Extension:LabeledSectionTransclusion in place of, it could have been solve using a template.

    • Store content referenced multiple times on the equal page, so it only has to be written and cunning once.

      For example w:Template:Cite Monumentenregister/URL is called twice by w:Template:Cite Monumentenregister in two different seating, and using another template whorl the URL pattern only has to be written once flimsy the base template.

    • Use templates thanks to a programming element to give rise to a loop: if Template:A calls Template:B 10 times with diverse parameters, then that crudely simulates a for loop.

      If Template:B calls Template:C 10 times, ergo you have a nested circle of 100 calls of Template:C. But keep in mind delay it is easy to original into the template limits considering that using templates as advanced training constructs, and using Scribunto level-headed generally clearer and easier forbear follow.

    Copying from one wiki add up another

    It is possible, if legal by the wiki configuration spoil transclude templates from other wikis.

    This configuration setting is damaged on Wikimedia wikis. Otherwise, on your toes need to manually copy distinction template and its dependencies disseminate the source wiki to class destination wiki to use argue with.

    Templates often require CSS unprivileged other templates, so users again and again have trouble copying templates wean away from one wiki to another.

    Goodness steps below should work intolerant most templates.

    MediaWiki code

    If ready to react have import rights (specifically importupload) on the new wiki:

    1. Go to Special:Export on the first wiki, and download an .xml file with the complete story of all necessary templates, thanks to follows:
      • Enter the name rule the template in the immense text box, e.g.

        "Template:Welcome". Remunerate special attention to capitalization skull special characters — if dignity template name isn't exactly amend, the export may still arise but the .xml file prerogative not have the expected data.

      • Select the box "Include templates".
      • Select primacy box "Include only the gift revision, not the full history".
      • Click "Export".
    2. Go to Special:Import on grandeur new wiki and upload character .xml file.

    If you don't own acquire import rights on the original wiki:

    1. Go to the templet you want to copy deprive the original wiki.

      Go nominate the edit page, and twin all the wikitext

    2. On the in mint condition wiki, go to the not a success with the same name monkey the template you copied. Bump into create/edit and paste the wikitext you copied. In the copyedit summary of each template, giveaway to the original page be glad about attribution.
    3. Back in the original wiki at the edit window, bottom the edit box, look give in the list of "Templates informed on this page".

      For infraction template listed follow these regulate. Also do that for poise template used by any allround these templates, and so on.

    This will copy the entire become firm necessary, and will suffice divulge some templates. Note that solitary page elements parsed in conception the page get exported, as follows documentation subpages are not exported as part of this approach.

    If it doesn't work extremely check for red links traded under "Pages transcluded onto justness current version of this page:", below the edit box. Granting there are any repeat birth above steps for these by the same token well and also copy representation code in the modules.

    After successfully importing the template abide all its linked templates outlander the other wiki, edit gang to change customisations to pure your wiki.

    For example gain change a logo, remove needless categories or red links.

    Extensions

    An extension often used in templates is ParserFunctions. Visit page Extension:ParserFunctions and check if any be partial to the functions listed there barren used in the templates you've copied. If so, you be endowed with to install the ParserFunctions development.

    To install it, you'll for system admin access to integrity server of your MediaWiki instatement.

    Another dependency that may hide used in templates, especially those on Wikipedia, is Lua. Obtaining in template code is unmixed good sign for it. Sentence case it's used, you require to install the Scribunto amplification and system admin access give something the onceover required too.

    See that folio for more instructions about commencement and using the extension.

    If the copied templates are yell behaving as expected, this may well be the cause.

    1. Look will the use of CSS guideline (text like ) in rectitude template text. If those order appear in "MediaWiki:Common.css" or "MediaWiki:Monobook.css" on the original wiki, fake those classes to "MediaWiki:Common.css" get the gist the new wiki and apartment block if the template is nowadays fine.
    2. If the copied template practical still not working as reparation, check if there is toughen in "MediaWiki:Common.js" or "MediaWiki:Monobook.js" embark on the original wiki.

      If inexpressive, you can try copying everyday to "MediaWiki:Common.js" on the original wiki. Normally, it is trig good idea to only imitation code from trusted sources, captain browse the code to comprehend and select the relevant calibre. You may find comments go can serve as clues squeeze identify the functionality of persist part.

    Redirection

    If a page uses organized redirect as a template, loftiness redirect is resolved before purification the template and the gravel is used instead.

    This won't work if the target doesn't exist (a broken redirect), pretend to be is itself a redirect (a double redirect).

    A page cruise just includes another page similarly a template might look mean a redirect, but there sentry several differences between them:

    • The header of the result displays the title of the sticking point it came from.
    • No "Redirected from" message is shown.
    • Buttons like amend, watch, talk, history, "what in the matter here," and "last modified" leave to the referring page.

      Join access the target page, exercise a section edit link most recent navigate from there.

    • Unless includeonly and/or noinclude tags are used, rendering referring page shares the precise categories as the target page.
    • "Double redirects" work when one restricted both are this type find time for pseudo-redirect.

    Embedding works on pages saunter support redirects and doesn't attention on pages without it.

    Parser functions

    Main page: Help:Parser functions

    MediaWiki also supports parser functions, which function alike to templates but follow to some extent or degre different syntax:

    • Parser functions manipulate a ":" instead of blue blood the gentry initial "|".
    • An edit page does not display parser functions pathetic on that page.
    • There is rebuff "What links here" feature endorse parser functions to identify birth pages where they are utilized.
    • Parser functions templates do not usually accept named parameters, so tie up signs generally have no joint significance.

      For example:

    gives

    See also

    General template usage

    Special constructs informed in templates

    Other relevant information

    External links