User:Whiteknight/Header Snippets

This page is going to contain short code snippets that can be copy+pasted into header templates.

Print Versions
Want your navigational templates to disappear on the printable version of your book? Use this parser function around your navigational template:

Where "Print Version" is the subpage name of your printable version. For instance, if your print version is located at "My Book/My Print Version", and we wanted our navigational template to be a simple link to the TOC, we could write:

Forward and Back Links
Want to include forward and back links into your navigational template? If our header template is, we can include two optional arguments in it like this:

In our template, we can write this to create a forward link in our page, or no link if we don't have a "previous page" (such as the first page of your book):

Similarly, we can create an optional "next" link:

Putting these together, we can create a template with a forward link, a back link, and a link to the TOC in the middle:

My Book

Named Variables
If you would prefer to use named parameters instead of the default numbered parameters, you can write this instead:

and:

Simple Last and Next Links
If you don't want the page titles to appear in the forward and backward links, you can modify the code above to print simply "next" or "last":

and

Likewise, you can replace all the instances of the number "1" with the word "last" and all instances of the number "2" with the word "next", if you want to use named paramters instead.

Top Links
To make a link appear at the very top of the page, to the left of the page title, you can use the following span:

...

The links will appear at the top of the page, and will be disabled during printing.