Help:Navigational Templates
From QED
| ↑ | ||
| ← Editing | Navigational Templates | Refresh → |
| Help |
|
| Related topics |
One way to support navigation between pages is by using templates. Four specific templates are described on this page.
Please note that "white space" (blanks and new lines) are significant in templates.
Contents |
Navigation Bar
Perhaps the simplest navigational device is a navigation bar that can be placed at the top of every page in a folder. It would appear like this:
People | Talks | Papers | Meetings | Administration
This kind of navigational template allows the basic structure of a folder to be defined before all the pages are created. It also makes it visually clear to readers which page on the navigation bar they are currently visiting.
The template Template:FOLDER/Navigation is a meta-template with instructions for creating the required navigational template for this style of navigation bar.
Table of Contents
A simple but often effective way to support navigation is with a table of contents (TOC) defined using a template, as illustrated by the navigation menu on the right of this page. One advantage of this method is that the MediaWiki engine modifies the highlighting of the current page — notice that in the TOC on the right, the reference to this page (Navigational Templates) is not a hyperlink (it is rendered in black), even though the template defines it as a hyperlink.
Thus, the specification of the TOC has only to be done once. The same template can then be included on each page without any modification.
To use this kind of template, you may wish to start with Template:Meta/TableOfContents as a guide.
Previous-Next Templates
The navigational bar at the top of this page was generated by a "previous-next" template. The main advantages and disadvantages of this kind of template are as follows:
- Cons
- each page must invoke the template in a slightly different way
- insertion or deletion of a single page in a chain requires several updates
- Pros:
- for very large groups of pages, the navigation bar presents less clutter than a TOC
- if there is a naturally linear ordering, using a "previous-next" template makes it easy for editors to create the next page — just click on the right-arrow.
Template:PreviousNext
The navigational bar at the top of this page was generated using the template Template:PreviousNext as follows:
{{PreviousNext|Contents|Editing|Refresh}}
The full name of the template is given first, then the name of the "Up" page, and finally the names of the previous and next pages. The namespace is implicit in all cases — in the present instance, Help:.
Template:navbar
For pages in the same subdirectory (e.g. Course:GEO206/2006) the navbar template may be more convenient as it saves having to repeat the subdirectory name. The syntax is slightly different:
{{navbar|Base|Previous Page|Up Page|Next Page}}
On this page (in the Help: namespace), the above invocation produces:
| ↑ | ||
| ← Previous Page | Up Page | Next Page → |
The Base page specification determines the directory in which the other pages are located. For example, given the following specification in the Course: namespace:
{{navbar|GEO206/2006|January|Up|March}}
the back-arrow would become a link to the page: "Course:GEO206/2006/January".
See also
For examples of how templates can help, see:












