Jump to content

Template:Portal navigation/doc

From Wikimania

The portal navigation template is a meta-template for creating consistent, responsive navigation headers for portals.

It is meant to be reasonably customizable, allowing different portals to "brand" themselves as they see fit, while maintaining consistent functionality so that different teams do not need to re-invent the wheel.

{{Portal navigation
| portalname =
| wrc =
| themecolor =
| tab1 =
| tab2 =
| tab3 =
| active =
}}
  • portalname – The name of the portal. Accepts any and all wikitext, so feel free to add links, images, what have you.
  • wrc – Is this portal part of the Wikimedia Resource Center? If you specify yes, true, or 1, {{WRC badge}} will be added atop your navigation header. Otherwise, nothing will happen.
  • themecolor – the primary color, used for the background color of the header bar and the color used to highlight the active tab. Must be a three- or six-digit hexadecimal code such as #abcdef or #999.
    • Note that you don't need to specify the text color. Black or white is automatically chosen based on whichever gets more contrast. You can manually set the color however; see below.
    • Please consider checking your color for contrast with black (#000) and white (#fff).
  • tabN – wikitext for each tab. Accepts wikitext; remember, it won't create your link for you. Each tab is numbered, e.g. tab1, tab2, etc. You can have as many or as few tabs as you would like.
  • active – which tab is the active tab. Use the number of the tab, and that number tab will be highlighted. If you are creating a template using this template, it is recommended you set active = so that the other template can then define the value. See {{Learning and Evaluation portal navigation}} as an example of this in action.
{{Portal navigation
| portalname = Meta-Wiki!
| wrc = no
| themecolor = #abcdef
| tab1 = [[Home]]
| tab2 = [[Wikimedia News]]
| tab3 = [[Meta:Babel|Babel]]
| active = 2
}}

Subtabs

[edit source]

It is possible under each tab to have subtabs. These are represented as listed links. Note that the active parameter only applies to whichever main tab is active. Subtabs do not indicate active state, other than being bolded text instead of a plain link.

Subtabs are defined like this: subtabN-X, where N is the number tab, and X is the number subtab.

Note that subtab navigation is not shown unless the applicable tab is active. In other words, if you are on tab 2, the subnavigation for tab 1 will be invisible.

{{Portal navigation
| portalname = Meta-Wiki!
| wrc = no
| themecolor = #abcdef
| tab1 = [[Home]]
| subtab1-1 = [[Meta:About]]
| tab2 = [[Wikimedia News]]
| subtab2-1 = [[Tech/News]]
| subtab2-2  = [[VisualEditor/Newsletter]]
| subtab2-3 = [[Reports]]
| tab3 = [[Meta:Babel|Babel]]
| active = 2
}}

Tab icons

[edit source]

You can specify icons through icon1, icon2, etc. Be sure to use full image syntax; i.e., not just the name of the image.

{{Portal navigation
| portalname = Meta-Wiki!
| wrc = no
| themecolor = #333
| icon1 = [[File:Home font awesome.svg|x25px|link=]]
| tab1 = [[Home]]
| active = 1
}}
Meta-Wiki!

Custom header styles

[edit source]

You can specify custom CSS styles using the headerstyle parameter. Accepts CSS-type style parameters, separated by semicolons.

{{Portal navigation
| portalname=This is an abomination
| themecolor=#ff0000
| headerstyle = font-family:'Comic Sans MS', monotype; color: turquoise;
| tab1 = [[Home]]
| active = 1
}}
This is an abomination

(Please do not abuse this feature.)