banner



How To Add A Template To Wiki

Contents

  • i Finding and using templates
  • 2 Creating a basic template
  • 3 Advanced usage
    • three.ane Template parameters
    • iii.2 Substituting templates
    • 3.iii Documentation
    • iii.4 Lua-based templates
  • 4 Copying and updating templates
  • 5 Where to find more templates
  • 6 See also
  • 7 Further help and feedback

Templates are pages designed to be included on other pages. They are constitute in the Template namespace and commonly display material that needs to exist shown on multiple pages at the same fourth dimension. Templates are vital tools for wikis to run efficiently.

There are many different types of templates that fulfill different purposes. Templates like infoboxes or citations promote a uniform style on the wiki, while others are used in tandem to construction a single page such as the chief folio.

Template pages are created and modified using the source editor. Virtually templates tin can be added, or transcluded, on pages while using any editor interface, but complicated templates may be easier to work with in the source editor. Editing a transcluded template will update how it appears on all of the pages where the template is transcluded.

Finding and using templates

A user inserting a template, by clicking the "Insert" dropdown, then finding "templates"

Insert a template with the VisualEditor using this dropdown.

New Fandom communities accept a set of ready-to-utilize default templates. You tin can view a complete list of templates on whatsoever community by going to Special:AllPages and selecting "Template" from the namespace dropdown menu.

Once you've figured out what templates you lot accept to work with, you lot can begin thinking virtually how to use them in their most basic grade. The instructions are slightly different depending on the editor interface:

  • In the VisualEditor, click on the bolded word INSERT establish in the top middle of the page and click "Templates" from the dropdown listing. Yous can also type {{ in the folio itself. In the dialog box that appears, search for the proper name of the template you wish to include.
  • In the source editor, simply type {{TemplateName}} replacing TemplateName with the name of the template.

Creating a basic template

Templates can exist powerful, but some templates can exist complicated. It oftentimes helps to start by creating the simplest possible kind of template.

  • On your customs, navigate to Template:Example using the accost bar of your browser. On Community Central, this would be https://community.fandom.com/wiki/Template:Example
  • Click the "Create Source" button in the peak-right corner of the folio. This volition open up the source editor.
  • A popup will appear, asking you to choose a template type. Select the pick that matches the template you lot want to make, or select "Unknown" if you're non sure, then click the "Save" button at the pinnacle-correct.
  • Type a few words or a sentence in the editor. Example: This is example template text. For demo purposes only.
  • Click "Save" at the bottom right. Y'all've simply created a template!
  • Get to your user contour or some other testing page on your community.
  • Follow the steps in a higher place to insert the template depending on your preferred editor.

The page that you created should show:

This is example template text. For demo purposes only.

Congratulations! Yous've successfully created and used a template! Now you can modify the content of your template and add it to more pages to make it more useful for your community.

For a total guide on creating and using templates, visit Help:Templates on MediaWiki to learn more.

Advanced usage

Template parameters

An image of a user selecting parameters in Visual Editor, in a template named "Album". The parameters of the template contain "title, image, imagecaption", and a button saying "Add more fields"

Selecting parameters in VisualEditor'south template tool

Many templates also feature parameters. Call back of these like variables. Different pages can use the same template with unlike values for each parameter. Depending on the template, this can change the template's text or the way the template is designed.

Let's accept Template:Wikipedia as an instance. This template is designed for pages that employ content from a Wikipedia page; it creates a box with a link to the Wikipedia page. Adding merely {{Wikipedia}} assumes that the page on Wikipedia has the verbal same name equally the folio the template is beingness used on. However, if the 2 page names are different, we tin utilise a parameter to alter the link. Adding {{Wikipedia|Microsoft}} ensures that the link volition point to Wikipedia's "Microsoft" page. VisualEditor provides options for setting parameter values when adding a template or clicking on it in the editor.

To learn more, see Assistance:Template parameters.

Substituting templates

Template substitution is like using a cookie cutter.

Adding a template to a page through VisualEditor or by typing {{TemplateName}} volition e'er show the most recent revision of the template on that page. This process is called transclusion.

A different way to use a template is to substitute its content into the folio. Template commutation tin only exist done in source editor by changing the code to {{subst:TemplateName}}. Once the page is saved, the link to the template is replaced by the template'south output.

Editing the template will not update the content that was substituted into the page. Call up of substitution like a cookie-cutter: if you lot use a cookie cutter to make a few cookies and then alter the shape of the cookie cutter, the cookies you already made will non modify their shape.

To learn more, run into Help:Substituting templates.

Documentation

Suppose yous want to use a template. You lot effort to utilize a standardized template, like {{Observe}}. However, you don't know how to use the template and yous don't want to look at the template code.

This is where documentation comes in. Many complex templates often have a documentation section, added using {{documentation}}. The documentation of a template is useful to provide instructions on how to utilize the template, its parameters, and also examples of a template. It can also accept mw:Assistance:TemplateData to assistance y'all when using VisualEditor.

You tin can easily add together documentation on templates that don't accept 1, if you lot know how the template it used.

To learn more, visit Assistance:Template documentation.

Lua-based templates

Most bones templates are designed using wikitext, the same code used on pages. Yet, avant-garde wikitext templates can appear also complicated to read and slow down the pages they're used on. In these cases, Lua is an alternative choice. While coding in Lua can appear daunting at first, Lua-based templates perform faster than their wikitext counterparts and tin be easier to read and empathise. The Fandom Developers Wiki maintains a list of Global Lua Modules designed to replace or enhance common wikitext templates; some of these global modules are available on new communities too.

To learn more, run into Help:Lua.

Copying and updating templates

Contributors throughout Fandom accept made all unlike kinds of templates. It is oft simpler to copy an existing template and alter it for your needs rather than create one from scratch. In most cases, you are complimentary to re-create templates from other Fandom wikis based on the shared CC-BY-SA license. Giving credit to the community from which you lot copied the template is vital.

It is recommended to export and import templates, equally it keeps the edit history which is vital by CC-Past-SA license required past FANDOM. (Although it requires adminsitrator permissions.)

If you can't import pages, an alternative is to copy the template. Here are some basic steps to re-create most templates:

  1. Find the template y'all want to re-create.
  2. Click the Edit button, select all of the wikitext, and copy it.
  3. Create a new template folio in your customs.
  4. Paste the wikitext code you copied, add an edit summary which credits the wiki from which you obtained the template, so click the "Save" button.

More data can exist found at this page on Templates Wiki.

Where to find more templates

  • Templates Wiki has many useful templates designed for utilise in other wikis. (Recommended templates to copy)
  • Dev Wiki holds a repository of Global Lua Modules which tin exist used from any Fandom wiki. Run across the documentation of each module about how to create the appropriate template on your wiki and link it to the Lua code. Some CSS or JavaScript enhancments on Dev Wiki also accept related templates.
  • Customs Central has a lot of templates, though nigh of them aren't suitable for other wikis. Some of them serve every bit global templates and tin be used on any wiki without copying - encounter Aid:Shared templates.
  • Wikipedia or in MediaWiki.org, though you need to read their guide on copying the templates. Credit them by using {{wikipedia}} or by specifying the approriate origin.
  • Other wikis related to your topic. For instance, if yous're on a TV wiki, look at other TV wikis you lot admire, specially those in your topic's own genre.
  • Fandom UCP Starter Pages. This is where the initial main page and templates come up from when creating a new wiki today. Sometimes the templates there tin can aid older wikis or serve as a basis for developing a template.

See besides

  • Assistance:Templates on MediaWiki, the full guide on using templates.
  • Help:Template types
  • Assistance:Template parameters
  • Assistance:Shared templates
  • Assistance:Infoboxes, a frequently used template style used to summarize article content
  • Help:Substituting templates
  • Assist:Transclusion on MediaWiki
  • Help:Lua

Further assist and feedback

  • Browse and search other help pages at Help:Contents
  • Bank check Fandom Community Central for sources of further help and support
  • Bank check Contacting Fandom for how to written report any errors or unclear steps in this commodity

How To Add A Template To Wiki,

Source: https://community.fandom.com/wiki/Help:Templates

Posted by: wilsonsirtho.blogspot.com

0 Response to "How To Add A Template To Wiki"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel