Template:Legacy navigation tab

From Terraria Wiki
Jump to navigation Jump to search
This template is i18n-ready, which means it is easy to localize for different languages. Please see I18n & l10n for templates to learn more.
See Template:Legacy navigation tab/l10n for the localization of this template.
Important.svg
CAUTION: Terraria Wiki code is complex!!!
If you want to use this code on another wiki, wiki.gg staff are not able to assist you.
Please consider picking a different wiki to adapt code from, or making your own templates!
Remember that content on a wiki is more important than fancy formatting.
Template-info.svg Documentation The documentation below is transcluded from Template:Legacy navigation tab/doc. (edit | history)
Navigation tabs without this template.
Navigation tabs with this template.

This template adds a new tab at the top left (above the page title) which facilitates easy switching between a main article and its counterpart in the Legacy: namespace.

It also categorizes legacy pages in Category:Legacy platform differences. On mainspace pages, it adds the hidden tracking category Category:Mainspace pages with a corresponding Legacy page.

Moreover, it adds a banner on legacy pages to inform readers of the nature of the page and to provide an additional method of switching to the main article.

Finally, it sets the internal variable {{#var:__article_legacy_nav_tab_page}} to the name of the counterpart page. This has no implications for normal editing but is useful for other templates and modules to change their behavior. For instance, {{item infobox}} does not display the "old" item image by default if this variable is set in mainspace, because it understands that the article has a counterpart in the Legacy: namespace where the "old" image belongs.

Usage

Place this at the very top of an article, above all other wikicode:

{{ legacy nav tab | <page> | exclusive = <page> (optional) | legacyversions = <legacy versions> (optional) | modernversions = <modern versions> (optional) }}

First unnamed parameter

Target page. This can almost always be omitted, as it is determined automatically. It is only needed when the mainspace and Legacy page titles do not match, such as Volcano and Legacy:Fiery Greatsword. Use {{ns:11000}}: to refer to the Legacy: namespace. Example:

Volcano Legacy:Fiery Greatsword
{{legacy nav tab|{{ns:11000}}:Fiery Greatsword}} {{legacy nav tab|Volcano}}
exclusive

Base for the versions displayed in the banner, as interpreted by {{eversions}}. It can be omitted most of the time, as the current page name is used by default. For example, the Sky Mill is exclusive to Desktop version Desktop, Console version Console, Old-gen console version Old-gen console, and Mobile version Mobile ({{eversions|Sky Mill}}), so the banner shows Desktop version Desktop, Console version Console, and Mobile version Mobile on the mainspace page (Sky Mill) and Old-gen console version Old-gen console on the Legacy page (Legacy:Sky Mill) – the automatic version detection works in this example. The related page Recipes/Sky Mill, however, has a name that is not recognized by {{eversions}}, so the automatic version detection does not work and the parameter must be used to provide the entity name: |exclusive=Sky Mill. If set, the parameter should have an identical value on the mainspace and Legacy page.

legacyversions, modernversions

In case the automatic detection of the proper versions for the banner is insufficient and the $exclusive parameter cannot be used either, the versions may need to be defined manually. These two parameters facilitate that. Accepted version names are described at Template:Versions, and multiple versions are to be separated with a slash (/). $modernversions can be omitted most of the time, as it defaults to desktop/console/mobile. If set, the parameters should have identical values on the mainspace and Legacy page. For example, Console version history and Legacy:Console version history require manual versions because neither the automatic version detection nor the $exclusive parameter with any entity recognized by {{eversions}} work there. Both pages include the parameters like so: {{legacy nav tab|modernversions=console|legacyversions=oldgen}}.