Help
Wiki Glossary
From Dogcraft Wiki
m (Update) |
m (Domino moved page User:Domino/Project:Wiki Glossary to Help:Wiki Glossary: Moving this project to the Help namespace) |
(No difference)
|
Revision as of 02:09, 28 July 2024
Templates
Templates are a consistent way to re-use text (or other content) across the wiki, regardless of what page your editing. Every template has a name, some content, and may have parameters. A template's name is always the name of a wiki page in the Template:
namespace.
When you add a template to a page, you only need to add its name (and any parameters), and when viewing said page, the template name will be replaced with whatever is on the Template:
page the name is pointing to. When editing the page, you will continue to see the template behave differently from the rest of the page.
- In the VisualEditor, you can add templates using their own popup menu, in the top-bar at
Insert > Templates
by searching for the template's name. - In the Source Editor, you can add a template using a popup menu (accessed from the top-bar with the button), or by surrounding the template's name with two brackets like this:
{{template name}}
.
For example, lets look at the "Egg" template.
- Here, the name of the template is Egg, and it doesn't have any parameters.
- If you look at the Template:Egg page, you'll see the text "Eggs are great for breakfast.", that's the template's content.
Adding the template on any page will show that sentence once you exit the editor. So, {{Egg}}
generates: "Eggs are great for breakfast.". And if you were to change the text on the Template:Egg page to "Omelettes are great for breakfast.", then everywhere the Egg template is used would update automatically!
Parameters
The contents of a template (whatever is on the Template:Template name
page) can have special sections of text called a parameter. Parameters are kind of like variables or inputs, they can be specified on the page that's using the template. They usually have their own names and values.
- In the VisualEditor the template popup menu has a textbox for every parameter.
- In the Source Editor, the popup menu can be used, or parameters can be added like this:
{{template name|parameter_name = value|another_parameter_name = value}}
.
For example, lets look at the Read more
template:
- Here, the name of the template is "Read more"
- It has 1 parameter called "name"
- The content is "To read more about the topic, see the {{{name}}} page."
If you wanted to use this template on a page, you could do {{Read more | name = Leon}}
to generate "To read more about the topic, see the Leon page."
The following sections are not up to the standards of this page and serve more as a layout of what still remains to be written.
Modules
Similar to templates, modules live in the Module: namespace and work by including Lua scrips on a page. Module documentation is always found on the module's /doc subpage.
Gadgets
Gadgets are added by the extension of the same name. They are snippets of CSS and JavaScript that a user can choose to load. Gadgets can be enabled from the User Preferences.
MediaWiki:Common.css, Common.js, skin css and js and styles
The content of the MediaWiki:Common.css and MediaWiki:Common.js is loaded on all pages by default. The MediaWiki software also allows for skin-specific styles at skinname.css and skinname.js, in our case located at Dogcraft.css and Dogcraft.js. The skin specific versions may come with a performance drop, which is why they are not currently in use.
MediaWiki also allows for different global stylesheets to be loaded for each user group using the MediaWiki:Group-groupname.css or .js pages. Some of these (MediaWiki:Group-site-content-editor.css and MediaWiki:Group-sysop.css) were previously in use, but currently none are. See mw:Manual:User_group_CSS_and_JavaScript for more information.
In addition to the above, MediaWiki also allows for further style and script pages, but on the wiki, none of these are in use:
- User specific User:Username/Common.css and ./Common.js files - these are disabled on the wiki using a system preference ($wgAllowUserCss)
- User specific User:Username/skinname.css and ./skinname.js files - these are also disabled by $wgAllowUserCss.
- Global MediaWiki:Noscript.css and MediaWiki:Print.css pages, currently neither is in use
For more information see mw:Manual:Interface/Stylesheets
Useful tools
This section contains more advanced information, useful for managing the wiki.
WhatLinksHere
Special:WhatLinksHere/<pagename> lists every single page which has a link to <pagename>. Template transclusions also count as a 'link', so you can get a list of all pages where a specific template is in use. Every page has a button in the bottom right red box pointing to its Special:WhatLinksHere page, so you can get here fast. (This can be useful for redirects too, which are also included as 'links'.)
QQX language
When working with system messages, you can add ?uselang=qqx
to the end of the page URL (or &uselang=qqx
if the URL already has a question mark), which will show all the messages in use on the page by their name instead of their content. This can be extremely useful to find what message to edit. For example, you can check the system messages in use on this page: https://dogcraft.net/wiki/Help:Wiki_Glossary?uselang=qqx
Template documentation
There are several tools to make documenting a template easier. Templates should always be documented, to ensure that they can be easily understood and modified without contacting the template's creator, or months or years after the template's creation.
Template links
Using {{template link}}, {{template}}, {{tl}} or {{t}}
During template documentation, you might want to refer to the template itself, or link to a different template. In such cases, formatting the link to the template like a template in wikitext. The {{template link}} template achieves that. In fact, the previous sentence used it.
To display the parameter names of a template, you can add them as unnamed parameters to the {{template link}} template. They will be displayed as grayed out text like this: {{notice|<title>|<message>}}
Note: The {{t}}, {{tl}} and {{template}} templates function as aliases for {{template link}} and redirect to it. Using any of them will in actuality use {{template link}}.
Note: This template is from Wikipedia. If the documentation on this wiki is not enough for your uses, check wp:Template:Template link
Note: Originally, {{template link}} served as an alias for {{t}}, until they were switched. Now {{t}} is an alias for {{template link}}
Template link with braces
Using {{tt}}
Much like a normal template link, except for also including the braces inside the link. The "Using: <template>" portions on this page use this template.Expanded template link
Using {{tlx}}
An expanded version of the {{template link}} template including multiple formatting options allowing for marking substitution and adding parameter values. For adding just the parameter names, the normal {{template link}} template should be used. This template should be used when you want to show example parameter values to be inputted. To display both parameter names and values, use the {{[[Template:{{{1}}}|{{{1}}}]]}} template in place of the regulat '=' sign in the syntax.
Examples:
Template documentation subpages
Using {{documentation}}
Some templates use the /doc page for the template's documentation. For especially longer templates, and/or longer documentation pages, separating the template itself and its documentation into different pages may make maintaining them easier. On templates like this, use the {{documentation}} template to include the /doc subpage on the template page itself.