Template:DISPLAYTITLE

From PZwiki
Notebook.pngTemplate Documentation
Imbox notice.png
This template may have no transclusions.
It is substituted by a magic word. Magic words should be written with a colon : instead of a pipe |.

Template:DISPLAYTITLE is a behavior switch used to customize the display title. This functionality is part of the Display Title extension, which builds on the DISPLAYTITLE magic word, allowing the text of the display title to be customized, instead of just the styling.

It is important to note the warning sign at the top of this page preferring that the template form of DISPLAYTITLE not be used, but that rather the magic variable form of {{DISPLAYTITLE:}} be used directly as documented next. The template would simply call the magic word "DISPLAYTITLE:" anyway, so using template DISPLAYTITLE creates an (acceptable but) unnecessary step in page processing.

Magic words use a colon (:) instead of a pipe (|) as the separator to indicate the page name to process here. Use the magic variable. If "|" is used instead of ":", it places the page in Category:Pages which use a template in place of a magic word.

Usage

Use {{DISPLAYTITLE:displaytitle}} to change the display title of a page, with "displaytitle" being the string you want to be displayed. This will change the name at the top of the page, along with the displayed text on links.

Linking

Setting a custom display title will change the link title if one hasn't been set, i.e. no piped link. A piped link will always change the link title to the string after the pipe (|) in the link.

No display title and no redirect
[[A]] → A
[[A|X]] → X
Display title "Z" and no redirect
[[A]] → Z
[[A|X]] → X
Redirects to "B" with no display title
[[A]] → B
[[A|X]] → Z
Redirects to "B" with display title "Y"
[[A]] → Y
[[A|X]] → X


The below table demonstrates the behavior of text displayed in the link in more depth. A represents the title of a page (wiki title) and a represents the first character of the page title in lowercase (after the namespace, if it has one).
Example
[[A]] = [[Hammer]]
[[a]] = [[hammer]]

Source Page with link Page "A" Does Not Redirect Page "A" Redirects to Page "B"
Page "A" Has No Display Title Page "A" Has Display Title "Z" Page "B" Has No Display Title Page "B" has Display Title "Y"
[[A]] A Z B Y
[[a]] a
[[A|A]] A Z B Y
[[a|A]] A Z B Y
[[A|a]] a
[[a|a]] a
[[A|X]] X
[[a|X]] X

Translating

The primary use-case and sole intention of this magic word/extension is for use in translating. Since all language pages are a subpage of the English version of the page, this can be incredibly confusing for non-English speakers, therefore {{DISPLAYTITLE:displaytitle}} is used at the top of the page, changing the title to the non-English version of the English word/phrase.

This has the added benefit of automatically changing a link to the display title of the page it's linked to, avoiding the need to add a custom title to the link. In templates, this is used with the #getdisplaytitle parser function, which will get the display title of the page provided. For example:

{{#getdisplaytitle:Book:42}}

will show the displaytitle of page Book:42. To get the display title of the current page, use:

{{#getdisplaytitle:{{FULLPAGENAME}}}}

Misuse

This magic word's permitted uses are listed below:

  • Translations for language code subpages. E.g. Hammer/pl → Młotek
  • Renaming a subpage to be the subpage name. E.g. Mods/Hydrocraft → Hydrocraft
    • This usage should be avoided and moving the page should be considered instead.
  • Change the styling (default MediaWiki functionality). E.g. The Dog Goblin → The Dog Goblin
  • Removing the capital at the start of a title to appear as it is in-game. E.g. Conspiracy crap??? → conspiracy crap???

There may be various other permitted use-cases, however these must be approved by a wiki administrator or consensus reached amongst the community prior.

Due to this magic word's ability to affect several articles and modify an interface element, it is prone to being used for vandalism or deception. It's important to note that using this template in that way will result in a permanent block.

See also

Editors can experiment in this template's sandbox.