MediaWiki Tips: Difference between revisions

From MediaWiki-1.39
Jump to navigation Jump to search
Tag: Manual revert
Line 43: Line 43:
</div>
</div>
</pre>
</pre>
==Overview==
Templates are wiki pages whose content can be embedded in other pages. They allow for easy translations and help maintain consistency among related documents. This page describes some templates for formatting text.
Also see [[Help:Templates]]. There is also [[wikitech:Wikitech documentation templates|a similar list for wikitech.wikimedia.org]].
{{TOC}}
== Templates ==
{| class="wikitable"
|-
! Template !! Example syntax !! Example output
|-
! <h5> [[Template:Hatnote|Hatnote]] </h5>
| <pre>{{hatnote|Here is my note.}}</pre>
| {{hatnote|Here is my note.}}
|-
! <h5> [[Template:Caution|Caution]] </h5>
| <pre>{{Caution}} Here is my caution 1.</pre>
<pre>{{Caution|Here is my caution 2.}}</pre>
| {{Caution}} Here is my caution 1. <br><br> {{Caution|Here is my caution 2.}}
|-
! <h5> [[Template:Warning|Warning]] </h5>
| <pre>{{warning}} Here is my warning 1.</pre> <pre>{{warning|Here is my warning 2.}}</pre>
| {{warning}} Here is my warning 1. <br><br> {{warning|Here is my warning 2.}}
|-
! <h5> [[Template:Todo|Todo]] </h5>
| <pre>{{Todo|Here is my todo.}}</pre>
| {{Todo|Here is my todo.}}
|-
! <h5> [[Template:Fixtext|Fixtext]] </h5>
| <pre>{{Fixtext|Here is my fixtext.}}</pre>
| {{Fixtext|Here is my fixtext.}}
|-
! <h5> [[Template:Note|Note]] </h5>
| <pre>{{note|Note 1}}</pre>
<pre>{{note|Note 2|reminder}}</pre>
<pre>{{note|Note 3|error}}</pre>
<pre>{{note}} Loose test </pre>
| {{note|Note 1}} <br> {{note|Note 2|reminder}} <br> {{note|Note 3|error}} <br> {{note}} Loose test
|-
! <h5> [[Template:Tip|Tip]] </h5>
| <pre>{{Tip|Here is my tip.}}</pre>
| {{Tip|Here is my tip.}}
|-
! <h5> [[Template:Notice|Notice]] </h5>
| <pre>{{Notice|Here is my notice.}}</pre>
| {{Notice|Here is my notice.}}
|-
! <h5> [[Template:Main|Main]] </h5>
| <pre>{{Main|test|sandbox|w:foo}}</pre>
| {{Main|test|sandbox|w:foo}}
|-
! <h5> [[Template:See also|See also]] </h5>
| <pre>{{See also|test|sandbox|w:foo}}</pre>
| {{See also|test|sandbox|w:foo}}
|-
! <h5> [[Template:Merge|Merge]]</h5>
| <pre>{{{{merge|Example_page}}</pre>
| {{merge|Example_page|nocat=true}}
|-
! <h5> [[Template:Talkquote|Talkquote]] </h5>
|<pre>{{talkquote|foo bar bang|example}}</pre>
| {{talkquote|foo bar bang|example}}
|-
! <h5> [[Template:Smaller|Smaller]] </h5>
| <pre>Body text {{Smaller|(note with smaller text)}}</pre>
| Body text {{Smaller|(note with smaller text)}}
|-
! <h5> [[Template:Status|Status]] </h5>
| <pre>{{status}}</pre>
<pre>{{status|done}}</pre>
<pre>{{status|on hold}}</pre>
<pre>{{status|not done}}</pre>
| {{status}} <br><br><br> {{status|done}} <br><br><br> {{status|on hold}} <br><br><br> {{status|not done}}
|-
! <h5> [[Template:Doing|Doing]] </h5>
| <pre>{{Doing}}</pre>
| {{Doing|nocat=yes}}
|-
! <h5> [[Template:Not done|Not done]] </h5>
| <pre>{{Not done}}</pre>
| {{Not done}}
|-
! <h5> [[Template:Done|Done]] </h5>
| <pre>{{Done}}</pre>
| {{Done}}
|-
! <h5> [[Template:Resolved|Resolved]] </h5>
| <pre>{{Resolved}}</pre>
| {{Resolved|nocat=yes}}
|-
| <h5> [[Template:Documentation needed|Documentation needed]] </h5>
| <pre>{{Documentation needed}}</pre>
<pre>{{Documentation needed|section}}</pre>
| {{Documentation needed|nocat=true}} <br/>
{{Documentation needed|section|nocat=true}}
|-
! <h5> [[Template:Fixme|Fixme]] </h5>
| <pre>{{Fixme}}</pre>
| {{Fixme|nocat=yes}}
|-
! <h5> [[Template:Historical|Historical]] </h5>
| <pre>{{Historical}}</pre>
| {{Historical|nocat=yes}}
|-
! <h5> [[Template:Outdated|Outdated]] (Alias: [[Template:Update|Update]]) </h5>
| <pre>{{Outdated}}</pre>
<pre>Alias: {{Update}}</pre>
| {{Outdated|nocat=yes}}
|-
! <h5> [[Template:HistoricalProject|HistoricalProject]] </h5>
| <pre>{{HistoricalProject}}</pre>
| {{HistoricalProject|nocat=yes}}
|-
! <h5> [[Template:Archived extension|Archived extension]] </h5>
| <pre>{{Archived extension}}</pre>
| {{Archived extension|nocat=yes}}
|-
! <h5> [[Template:Soft redirect|Soft redirect]] </h5>
| <pre>{{Soft redirect}}</pre>
| {{Soft redirect|nocat=yes}}
|-
! <h5> [[Template:Draft|Draft]] </h5>
| <pre>{{Draft}}</pre>
| {{Draft|nocat=yes}}
|-
! <h5> [[Template:DoNotTranslate|DoNotTranslate]] </h5>
| <pre>{{DoNotTranslate}}</pre>
| {{DoNotTranslate|nocat=yes}}
|-
! <h5>[[Template:Last updated|Last updated]]</h5>
| <pre>{{Last updated}}</pre>
| {{Last updated|nocat=yes}}
|-
! <h5>[[Template:Doc-links|Doc-links]]</h5>
| <pre>{{Doc-links|Link to an example doc}}</pre>
<pre>{{Doc-links|Link to a doc template|template}}</pre>
| {{Doc-links|[[Link to example doc]]}}<br/>
{{Doc-links|[[Link to a doc template]]|template}}
|-
! <h5>[[Template:TabbedWindowBegin|TabbedWindow]]</h5>
|<pre>{{TabbedWindowBegin}}</pre>...<pre>{{TabbedWindowEnd}}</pre>
|
{{TabbedWindowBegin}}
=== Python ===
<syntaxhighlight lang="Python" line='line'>
code
</syntaxhighlight>
=== JavaScript ===
<syntaxhighlight lang="javascript" line='line'>
code
</syntaxhighlight>
{{TabbedWindowEnd}}
|}
[[Category:Documentation]]
[[Category:Maintenance]]


== Zero-JS Enhancements ==
== Zero-JS Enhancements ==

Revision as of 11:27, 22 January 2026

MediaWiki Tips

This page collects useful formatting techniques, admin tricks, and style conventions used across the Sh1re Commons and related wikis (e.g. Eckfordc). Contributions welcome.

Naming, Linking, and Underscores

MediaWiki converts spaces to underscores (`MediaWiki_Tips` → `MediaWiki Tips`).

You can also use internal links like this:

[[MediaWiki Tips]]

If the page doesn’t exist, it shows up as a red link — clicking it lets you create the page directly.

Template Styling

===

Note: {{{1}}}

===

Note: Use this template to show helpful callouts like this one.


Create or edit the template here: Template:Note

Paste this code:

<div style="border-left: 4px solid #36c; background: #eef; padding: 0.8em; margin: 1em 0;">
<strong>Note:</strong> {{{1}}}
</div>

===

⚠️

Warning: {{{1}}}





===
⚠️

Warning: Use this template to flag risky actions, like editing core DB tables.






Create/edit Template:Warning with this:

<div style="border-left: 4px solid #c00; background: #fee; padding: 0.8em; margin: 1em 0;">
<strong>Warning:</strong> {{{1}}}
</div>


Overview

Templates are wiki pages whose content can be embedded in other pages. They allow for easy translations and help maintain consistency among related documents. This page describes some templates for formatting text.

Also see Help:Templates. There is also a similar list for wikitech.wikimedia.org.

Template:TOC

Templates

Template Example syntax Example output
Hatnote
{{hatnote|Here is my note.}}

Here is my note.


Format like so:
{{{Hatnote|content is content}}}


Caution
{{Caution}} Here is my caution 1.
{{Caution|Here is my caution 2.}}
Template:Caution Here is my caution 1.

Template:Caution
Warning
{{warning}} Here is my warning 1.
{{warning|Here is my warning 2.}}
⚠️

Warning: {{{1}}}





Here is my warning 1.

⚠️

Warning: Here is my warning 2.





Todo
{{Todo|Here is my todo.}}
Template:Todo
Fixtext
{{Fixtext|Here is my fixtext.}}
Template:Fixtext
Note
{{note|Note 1}}
{{note|Note 2|reminder}}
{{note|Note 3|error}}
{{note}} Loose test 

Note: Note 1


Note: Note 2


Note: Note 3


Note: {{{1}}}

Loose test
Tip
{{Tip|Here is my tip.}}
💡
   Tip: Here is my tip.





Notice
{{Notice|Here is my notice.}}
   Upcoming Event: Annual Community Meetup 
Scheduled for: TBA at Main Hall

Join us for our yearly gathering to discuss upcoming wiki projects and milestones!

Main
{{Main|test|sandbox|w:foo}}
Template:Main
See also
{{See also|test|sandbox|w:foo}}
Template:See also
Merge
{{{{merge|Example_page}}
Template:Merge
Talkquote
{{talkquote|foo bar bang|example}}
Template:Talkquote
Smaller
Body text {{Smaller|(note with smaller text)}}
Body text Template:Smaller
Status
{{status}}
{{status|done}}
{{status|on hold}}
{{status|not done}}
Template:Status


Template:Status


Template:Status


Template:Status
Doing
{{Doing}}
Template:Doing
Not done
{{Not done}}
Template:Not done
Done
{{Done}}
Template:Done
Resolved
{{Resolved}}
Template:Resolved
Documentation needed
{{Documentation needed}}
{{Documentation needed|section}}
Template:Documentation needed

Template:Documentation needed

Fixme
{{Fixme}}
Template:Fixme
Historical
{{Historical}}
Template:Historical
Outdated (Alias: Update)
{{Outdated}}
Alias: {{Update}}
Template:Outdated
HistoricalProject
{{HistoricalProject}}
Template:HistoricalProject
Archived extension
{{Archived extension}}
Template:Archived extension
Soft redirect
{{Soft redirect}}
Template:Soft redirect
Draft
{{Draft}}
Template:Draft
DoNotTranslate
{{DoNotTranslate}}
Template:DoNotTranslate
Last updated
{{Last updated}}
Template:Last updated
Doc-links
{{Doc-links|Link to an example doc}}
{{Doc-links|Link to a doc template|template}}
Template:Doc-links

Template:Doc-links

TabbedWindow
{{TabbedWindowBegin}}
...
{{TabbedWindowEnd}}

Template:TabbedWindowBegin

Python

<syntaxhighlight lang="Python" line='line'> code </syntaxhighlight>

JavaScript

<syntaxhighlight lang="javascript" line='line'> code </syntaxhighlight> Template:TabbedWindowEnd

Zero-JS Enhancements

This wiki stack is hardened for legacy environments — no JavaScript required. Where others use JS libraries, we prefer:

  • **Pure HTML/CSS** navigation boxes and style blocks
  • **Table of contents** via headings (e.g. `== Section ==`)
  • **No collapsibles or toggles** (unless emulated with `<details>` in supported browsers)
  • Minimal inline CSS for color blocks, tooltips, and alerts

Recommended Conventions

  • Use `` for inline paths and scripts: php maintenance/update.php
  • Use `
    ` or `<syntaxhighlight lang="bash">` for CLI blocks
* All admin helper pages should be tagged like this: <pre> [[Category:Documentation]]

See also