Small wiki toolkits/Starter kit/Templates and Modules
Templates
[edit]Templates are written in Wikitext, HTML, CSS, and Lua. They can be transcluded on several wiki pages and are commonly used for standard warnings or notices, infoboxes, content formatting, and alignment, improving citations, etc. Templates are located in the Template
namespace on a wiki.
Visit the page Special:MostTranscludedPages
on a wiki to get a list of the most used templates. For example, b:fr:Special:MostTranscludedPages lists the most transcluded pages on French Wikibooks.
Popular templates on wikis
[edit]Templates in this category meet the criteria listed below:
- Widely used across wikis.
- Widely tested, proven useful and reliable.
- Well-documented and maintained.
- Implement an important feature of Wikimedia sites.
Note: The table below was last updated on 2020-05-12 and is based on this list manually curated in 2017.
Category | Template | Template description | Transclusion count on English Wikipedia |
---|---|---|---|
Standard warnings or notices | Ambox | Ambox stands for Article Message box and helps build message boxes for templates used in articles. Note: This template uses a Lua module. | 1,297,035 |
Stub | Helps identify a Wikipedia:Stub. | - | |
Underconstruction | Used for articles undergoing construction. | - | |
Warning | To be used only for essential warnings related to an article or a user. | 59,115 | |
Infoboxes | Infobox | An infobox is a fixed-format table usually found on the top right-hand corner of wiki articles and it presents a summary of information about the subject of an article. Template:Infobox is a meta-template used to organize an actual infobox template on a specific topic (e.g., Template:Infobox person). Additional notes:
|
3,206,447 |
Infobox person | Belongs to Category:People and person infobox templates, help organize meta-level information about a particular person. Note: This template uses Lua modules. | 318,685 | |
Infobox settlement | This template is used as a sub-template for several infobox front-end templates to produce an infobox for human settlements, for example, cities, towns, villages, communities, districts, counties, etc. Note: This template uses Lua modules. | 488,862 | |
Infobox building | This template is used to summarize information about a building or built structure, including skyscrapers, hotels, hostels, performance venues, and shopping centers. Note: This template uses Lua modules. | 19,120 | |
Taxobox | Help set out the biological classification (taxonomy) for a group of living things. Additional notes:
|
230,662 | |
Wikidata-powered Infoboxes | Creating or improving Wikipedia infoboxes is easier and faster using the data from Wikidata and, in turn, benefits Wikidata. A few solutions for using Wikidata-powered infoboxes are listed below:
See Wikidata:Infobox Tutorial for a tutorial on how to create Wikidata-powered infoboxes. |
- | |
Citations | Cite web | Helps create citations for web sources. Note: This template uses a Lua module. | 3,027,367 |
Cite journal | Helps create citations for academic and scientific papers and journals. Note: This template uses a Lua module. | 566,664 | |
Cite book | Helps create citations for books. Note: This template uses a Lua module. | 1,046,873 | |
Cite encyclopedia | Helps create citations for articles in encyclopedias. Note: This template uses a Lua module. | 100,793 | |
Citation needed | Helps identify uncited claims in articles. | 380,303 | |
Reflist | Formats and organizes a list of references. | 4,667,990 | |
Unreferenced | To be used on articles with no citations or references. | 224,511 | |
More citation needed | To be used on articles with insufficient citations. | 222,670 | |
Alignment & formatting | Center | Positions elements in the center of the page. | 516,521 |
Plainlist | Creates an unbulleted list. | 159,336 | |
Font color | Applies text and background color. | 90,312 | |
Utility | Birth date and age | Return's a living person's birth date and age. Note: This template uses a Lua module. | 546,196 |
Clear | Adds <div style="clear:both;"></div> and is used to prevent text from flowing next to unrelated images.
|
2,134,481 | |
Done + Done/See_also | Belongs to Category:Resolution templates, these templates are used inline and help mark the status of a talk page discussion, vote, or other processes. | 72,394 | |
Ping | Used in replying to a user(s) as it creates a wikilink to their page that notifies them. | 111,520 | |
Coord | Gives a standard representation for encoding locations by their latitude and longitude coordinates. | 1,152,903 | |
Lang | Help indicate a text in a specific language. There are several templates in Category:Lang-x templates available for different languages. | 221,029 | |
Documentation | Used on a template page for documenting related instructions. | 70,377 |
Guidelines for templates
[edit]- For writing, editing, and using templates, see Help:A quick guide to templates on English Wikipedia. See Help:VisualEditor/User guide#Editing templates for editing templates using the Visual Editor.
- For applying advanced techniques in templates such as using variable and parameter names, see Help:Advanced templates.
- To explore a wide range of templates used on Wikimedia projects, especially on bigger wikis:
- For templates on English Wikipedia, see Category:Wikipedia templates.
- For templates on other Wikimedia projects excluding Wikipedia, see the
Category:Templates
page of a project. For example, Category:Templates lists templates on English Wiktionary.
- To copy a template from one wiki to another, see Help:Templates#Copying from one wiki to another. Some additional notes:
- You can copy a template in two ways:
- Manually (if you do not have import rights on a wiki).
- Using Special:Export on the source wiki to export the template in an XML format, and then using Special:Import to import it on the destination wiki (if you have import rights on a wiki). This process is desirable as it saves duplication of work. It helps preserve the edit history as well as attribution to the original author.
- In some instances, when the template is complex or depends on an extension or a module, you might require:
- Advanced user rights. For example, for importing templates or modules via Special:Import, you will need to be in one of the following user groups: Administrators, Importers, Transwiki importers.
- Experienced users' help for installing an extension or troubleshooting. See steps for enabling of disabling an extension on a wiki and ask a technical question on the MediaWiki Project:Support desk.
- See the list of common issues which you might encounter while copying templates from one wiki to another at Manual:Using content from Wikipedia.
- You can copy a template in two ways:
- For translating templates in articles using the Content Translation tool, see Content translation/Templates.
Modules
[edit]A Module is written in Lua. Lua is a scripting language that is supported on all Wikimedia wikis via the Scribunto extension. Lua modules can be used to simplify complex templates that cause performance issues and for handling string, mathematical and logical operations. Modules can be used stand-alone but they are mostly used in conjunction with the templates. Modules are located in the Module
namespace on a wiki.
If a template is using modules, you will see the Template:Lua embedded on its documentation page. For a template to work, the modules it uses should be copied to another wiki as well, in addition to the template itself. Writing Lua modules is recommended for experienced MediaWiki template developers. See Lua/Tutorial and learn to adapt a template to a Lua module.
Visit the page Special:MostTranscludedPages
on a wiki to get a list of the most used templates on that wiki. For example, see Special:MostTranscludedPages for most transcluded pages on Hindi Wikisource.