Template:SubpageNav: Difference between revisions
Template page
More actions
Fixes to major bugs - Rewrite |
Changed <nav> element to div, since nav is not allowed. |
||
| Line 1: | Line 1: | ||
<templatestyles src="Template:SubpageNav/styles.css" /> | <templatestyles src="Template:SubpageNav/styles.css" /> | ||
<div class="subpage-nav-wrapper"> | <div class="subpage-nav-wrapper"><div class="subpage-nav" role="navigation" aria-label="{{ROOTPAGENAME}} navigation"><div class="subpage-nav-brand">{{#if:{{{icon|}}}|[[File:{{{icon}}}.png|20px|link={{{root|{{ROOTPAGENAME}}}}}]]|}}<span class="subpage-nav-title">[[{{{root|{{ROOTPAGENAME}}}}}|{{{name|{{ROOTPAGENAME}}}}}]]</span></div><div class="subpage-nav-links">{{#if:{{{1|}}}| {{{1}}}|<div class="subpage-auto-list">{{Special:PrefixIndex/{{{root|{{ROOTPAGENAME}}}}}/ |stripprefix=1}}</div>}}</div></div></div><noinclude> | ||
< | |||
<div class="subpage-nav-brand">{{#if:{{{icon|}}}|[[File:{{{icon}}}.png|20px|link={{{root|{{ROOTPAGENAME}}}}}]]|}}<span class="subpage-nav-title">[[{{{root|{{ROOTPAGENAME}}}}}|{{{name|{{ROOTPAGENAME}}}}}]]</span></div><div class="subpage-nav-links">{{#if:{{{1|}}}| {{{1}}}|<div class="subpage-auto-list">{{Special:PrefixIndex/{{{root|{{ROOTPAGENAME}}}}}/ |stripprefix=1}}</div>}}</div> | |||
</ | |||
</div><noinclude> | |||
== SubpageNav == | == SubpageNav == | ||
A compact, minimal horizontal navigation bar for any wiki page. Works on root pages and any depth of subpage. Auto-populates all subpages with full dropdown support for nested paths. | A compact, minimal horizontal navigation bar for any wiki page. Works on root pages and any depth of subpage. Auto-populates all subpages with full dropdown support for nested paths. | ||
Revision as of 06:43, 23 March 2026
SubpageNav
A compact, minimal horizontal navigation bar for any wiki page. Works on root pages and any depth of subpage. Auto-populates all subpages with full dropdown support for nested paths.
Basic Usage (auto-populate)
Drop this at the top of your page β it finds its own root and lists all subpages automatically:
{{SubpageNav}}
Works on the root page AND any subpage. On Example Project/About/More Details the nav will still correctly show Example Project as the brand and list all of its subpages.
With an Icon
{{SubpageNav|icon=emotes-face-smile-big}}
Manual List (advanced)
Pass a bulleted wikitext list as the first unnamed parameter to fully control the links. Nesting with ** creates dropdown menus:
{{SubpageNav|
* [[My Project/Overview|Overview]]
** [[My Project/Overview/Details|Details]]
* [[My Project/Gallery|Gallery]]
}}
Parameters
1β Optional manual wikitext list. If omitted, auto-populates via Special:PrefixIndex.iconβ Icon filename withoutFile:prefix or extension (e.g.emotes-face-smile-big).rootβ Override the root page name (defaults toSubpageNav).nameβ Override the display label in the brand area (defaults to root page name).
Technical Notes
- Styles: Template:SubpageNav/styles.css
- Dropdown & nesting behaviour: MediaWiki:Gadget-subpagenav.js
- The gadget hides the raw PrefixIndex output on load and replaces it with a clean nested list. No flash of unstyled content.
- The currently-viewed page is highlighted in the nav and its parent dropdowns are opened automatically.