Tiandi:Templates Tutorial

What are templates?
 can be thought of as standardized lines of code, which are meant for repetitive and flexible use and serve to make an article more concise and pleasing to the reader. Templates are used in the Tiandi Encyclopedia, and identically in other projects hosted by the Miraheze and foundations. In fact, templates in the Tiandi Encyclopedia are most often imported from. If you have already inserted your nations into the ownership list or created your own nation-page with the respective infobox, then you are probably already familiar with what templates can do. In any case, this tutorial will familiarize you with the process of using and creating templates according to your needs. No former coding knowledge is required, thanks to the simplistic MediaWiki functions (further reading: "").

Templates typically have three facets: the one the coder sees (raw product), the one the article editor sees (processed product), and the one the reader sees (end product). The raw product sets a framework and its ; in the case of the nation infobox, it defines the need of an image file for a nation's flag, or the need of numerical values for a nation's territorial area, or the need of dates for a nation's historical events, and so forth. The processed product is what a newcomer editor sees, meant to be a series of blank yet ready parameters, which they can copy to their own nation-page (without much coding knowledge, for accessibility's sake) and input their own nation's data, thus personalizing it. If the raw product was coded properly, then the end product will be clean (pure text and images) and show no signs of the coding language underneath.

Compare the following. Also note how blank or conflicting parameters do not show up at all, thus saving space where needed.

How do I use templates?
The Tiandi Encyclopedia does not have the same library of templates as Wikipedia. That is because many templates are irrelevant to our purposes. As the Tiandi project expands its scope however, there might be a need to import new templates from Wikipedia and other wiki projects. Importing a template is fairly simple, assuming you have already spotted a desired template in use by a Wikipedia page or an equivalent wiki project. By viewing or editing the source code of an article, you can identify a template's name; the name is part of the processed product. For example, the opening line "{{Infobox country" signals that the processed template's name is Template:Infobox country (see also: {{wp|Template:Infobox country}} on Wikipedia).

Methodology
Assuming the desired template is, as perhaps seen in the source code of Wikipedia article :
 * 1) Ensure that the template is not already imported. Easiest way to do so is to search for "Template:Infobox television" in the Tiandi Encyclopedia. It should lead to Template:Infobox television, meaning the template already exists within the Tiandi library and thus does not need to be re-imported. (To use a pre-existing template, skip to Step 4.) For the purposes of this guide, let us assume Template:Infobox television does not exist within Tiandi.
 * 2) You will be prompted to create the template page. Copy the source code of the Wikipedia template (see: View source for Template:Infobox television) and paste it to the Tiandi template page. The source code is thus the raw product.
 * 3) Before saving changes, ensure that the template does not depend on modules. Modules are imported the same as templates, but make sure to import modules with a "Module:" prefix, not "Template:". Again, copy from the module's source code onto a new module page in Tiandi: see for example Module:Infobox television disambiguation check (Tiandi) from View source code for Module:Infobox television disambiguation check (Wikipedia).
 * 4) With all modules imported, you may now save changes; the template page should now work. To use the template, you no longer need the source code (raw product), but rather the parameters' syntax (processed product), which you may paste to your target page (e.g. a television show in Tiandi, like The Survivor) and fill out accordingly; this is always found in the template's documentation on Wikipedia and other wiki projects. See:  and . Similarly, the nation infobox guide is the syntax (processed product) of  (Wikipedia), dependent on Template:Infobox country (Tiandi).

There have been rare coding errors despite proper module and template importation. Although these have never affected infoboxes, which is primarily what concerns Tiandi Encyclopedia, those issues mostly have to do with communicating with Wikipedia databases. It shouldn't be a cause of concern; some might be necessary to overcome error messages (especially ones related to ), as these  are sometimes visible to the reader and give an ugly impression. It should be noted: Importing a template (even disregarding its application's success) has no negative consequences on the encyclopedia whatsoever. In the case of for instance, the dependency  had to be tweaked as to remove the "wikidata value(s)" searching mechanism (see processed product: Module:Taxonbar/candidate), which presumably attempted to enumerate Tiandian fictional species (e.g. Bangju sea serpent) according to real taxonomy. By doing so, the error warning was effectively removed.

What now?
Practice your template skills by creating a nation page. Once you have uploaded a nation flag, you may want to create a "" for your nation. This will enable you to use the following processed products:  (flag thumbnail with nation page link) and   (flag thumbnail with no link); as seen in the nation ownership list. Assuming your nation is named Randomlandia, the template must be called "Template:Country data Randomlandia". To recapitulate, the raw product must be as follows:

The following guides may also be of interest:
 * Tiandi:Newcomer Guide
 * and
 * and
 * , and