Template:Chapter navigation with TOC/sandbox

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Template documentation[edit] [history] [purge]

About[edit]

This is a fork of Template:Chapter navigation; it was forked to avoid any legacy issues arising from changing its code. It uses CSS and JavaScript to position chapter navigations at both the top and bottom of a page.

The template adds:

  1. Top of page: navigation for the previous, book name, next pages of the book.
  2. Bottom of page: navigation for previous page, book name, and next page of the book.
  3. It also provides an option to add a mini TOC (Table of Contents) at the bottom of the page.
  4. It adds a book category, and sorts by chapter name.

Usage[edit]

Add this once at the bottom of a page:

For first and last chapter of a book, leave first or second field blank respectively:

It also provides an option to add a mini TOC (Table of Contents) at the bottom of the page, by using a third field:

  1. Create a subpage for a mini TOC, e.g. Book name/TOC mini
  2. Link the subpage in the third field, e.g. {{Chapter navigation with TOC|optional previous page name|optional next page name|TOC mini}}

Advanced tips[edit]

  • By default it adds a book category. To disable this add the nocat=yes switch, for example:
{{Chapter navigation with TOC|optional previous page name|optional next page name|TOC mini|nocat=yes}}
But if you are using a mini TOC, any category from there will be transcluded, unless it is wrapped with noinclude tags.
  • If transcluded into Book name/Print version, the template should not be displayed nor printed. But otherwise you can prevent transclusion by wrapping with noinclude tags, for example:
<noinclude>{{Chapter navigation with TOC|optional previous page name|optional next page name|TOC mini}}</noinclude>
  • If looking at Wikibooks with "Mobile view" (there is a link at the bottom of every Wikibooks page), the top navigation will not appear, as this is not possible in mobile view. The top navigation should also not appear on the main page.

Example[edit]

See also[edit]