Editing Help:Templates
Jump to navigation
Jump to search
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 1: | Line 1: | ||
{{ | {{NavWiki|template}} | ||
{{hatnote|This article is a technical guide to the use 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.}} | |||
| | 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. We use templates extensively on BG3Wiki, as they allow the use of easily accessible and consistent design, layout and formatting. | ||
}} | |||
{{hatnote|This article is a technical guide to the | |||
A ''' | |||
== Template creation == | |||
Template creation is an essential part of the technical BG3Wiki workflow. However, it's important to take care when creating or improving templates. | |||
To create or edit templates you need access to them. This can be requested on the Discord or by visiting an admin's talk page. | To create or edit templates you need access to them. This can be requested on the Discord or by visiting an admin's talk page. | ||
=== What to keep in mind === | === What to keep in mind === | ||
Line 58: | Line 12: | ||
# 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. | ||
# Have easy to use TemplateData. | # Have easy to use TemplateData. | ||
Line 68: | Line 21: | ||
** 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. | ||
=== Template documentation === | |||
{{hatnote|See also: [[Help: Template documentation]]}} | |||
Template creators are encouraged to document (on the template's page itself as well as via the TemplateData button on the same page) how to use that template, including usage examples and accepted values for any template parameters. If you're unfamiliar with a particular template, navigate to its page to learn how it works. If a template page does not show any usage instructions, it could still be a work in progress, and you may want to check with its creator before using it. | |||
See [https://bg3.wiki/wiki/Special:AllPages?namespace=10 All Pages (Template namespace)] for a full list of available templates on bg3.wiki. | |||
: | |||
== Cargo database == | === 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. | 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== |