Editing Help:Templates

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 6: Line 6:
{{hatnote|This article is a technical guide to the creation of templates on BG3Wiki. For a guide on how to use templates, see [[Help:Using templates]]. See [[Help:List of templates]] for a list of templates.}}
{{hatnote|This article is a technical guide to the creation of templates on BG3Wiki. For a guide on how to use templates, see [[Help:Using templates]]. See [[Help:List of templates]] for a list of templates.}}
{{NavWiki|help}}
{{NavWiki|help}}
A '''template''' is a special type of page designed to be transcluded within other pages. Templates allow editors to automatically insert frequently-used images, code, and formatting on a page.  
A template is a special type of page designed to be transcluded within other pages. Templates allow editors to automatically insert frequently-used images, code, and formatting on a page.  


To ensure standardised practices across the wiki, this page provides guidelines for the process of '''template creation'''.
To ensure standardised practices across the wiki, this page provides guidelines for the process of '''template creation'''.
Line 35: Line 35:


=== Shortcuts ===
=== Shortcuts ===
To make templates easier to use, each template should have 1-5 ''shortcuts'', added with {{t link|shortcut}}. These are redirects which have shorter names for ease of access. These do not need to follow the template page naming conventions.
To make templates easier to use, each template should have 1-5 ''shortcuts''. These are redirects which have shorter names for ease of access. These do not need to follow the template page naming conventions.


As few shortcuts as possible should be created in order to prevent ambiguity. It a single shortcut is sufficient, then additional shortcuts {{em|should not}} be created.
As few shortcuts as possible should be created in order to prevent ambiguity. It a single shortcut is sufficient, then additional shortcuts {{em|should not}} be created.
Line 58: Line 58:
# Easy to use, with as few parameters as possible.
# Easy to use, with as few parameters as possible.
# Have clear and easy to understand [[Help: Template documentation|template documentation]] with examples.
# Have clear and easy to understand [[Help: Template documentation|template documentation]] with examples.
# Always include a list of all of a template's shortcuts.
# Have easy to use TemplateData.
# Have easy to use TemplateData.


Line 68: Line 67:
** It is also important to remember when a parameter is used as a value, since in cases where a parameter is undefined, <nowiki>{{{parameter}}}</nowiki> will return the value "<nowiki>{{{parameter}}}</nowiki>", whereas <nowiki>{{{parameter|}}}</nowiki> will return its default value (in this case, an empty string).
** It is also important to remember when a parameter is used as a value, since in cases where a parameter is undefined, <nowiki>{{{parameter}}}</nowiki> will return the value "<nowiki>{{{parameter}}}</nowiki>", whereas <nowiki>{{{parameter|}}}</nowiki> will return its default value (in this case, an empty string).
* Expr and ifeq, when evaluating numbers, produce different results. This is because expr treats numbers as floats, whereas ifeq treats them as integers.
* Expr and ifeq, when evaluating numbers, produce different results. This is because expr treats numbers as floats, whereas ifeq treats them as integers.
=== Cargo database ===
Templates also allow the wiki to populate database tables with stored values using [https://m.mediawiki.org/wiki/Extension:Cargo Cargo queries]. This allows the wiki to create automatically generated lists of items or spells.


=== Formatting ===
=== Formatting ===
Line 105: Line 107:


TemplateData allows editors using the Visual Editor to easily add Templates to articles, but can also serve as an effective shorthand documentation for editors using the Source Editor.
TemplateData allows editors using the Visual Editor to easily add Templates to articles, but can also serve as an effective shorthand documentation for editors using the Source Editor.
== Cargo database ==
Templates also allow the wiki to populate database tables with stored values using [https://m.mediawiki.org/wiki/Extension:Cargo Cargo queries]. This allows the wiki to create automatically generated lists of items or spells.


== Additional resources==
== Additional resources==
Please note that all contributions to Baldur's Gate 3 Wiki are considered to be released under the CC BY-NC-SA license, except when noted otherwise (see BG3Wiki:Copyrights for details). If you do not want your writing to be edited and redistributed at will, do not submit it here. Per our Content Rules, you are promising that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)