Skip to content

09. Ordering Pages

James231 edited this page Jun 9, 2020 · 3 revisions

Using the default template the Sidenav first lists subfolders and then files with each folder dropdown. The file/folder names appear in the order the tool discovers them. This comes from the behaviour of the <ForeachSubFolder> and <ForeachFile> tags.

But for most documentations this won't be good enough. Here we describe how to specify the order of folders/pages yourself.

Order Pages in a Folder

The best way to order pages is on a 'per folder' basis. Within the Input folder find the folder containing the pages and subfolders you want to order. Within this folder create a text file with the name order.config. For example, to order the first level pages/folders in the sidenav, create the file at Input/order.config. The order.config file should have content in the following format:

1 index.html
2 pages.html
3 myhtml.html
4 mymarkdown.md
5 templates.html
6 Example Pages
7 orders.html

You'll notice the file consists of 2 columns separated by a space. The first column asigns an order number to each item (file or subfolder), and the second column specifies the item path (file name or subfolder name). When iterating through the files/folders the tool starts with the smallest order number and finishes with the largest.

You can also override these orders on a 'per page' basis ...

Overriding a Page's Order Number

To override the order specified in the order.config you can add a page property to the top of your page file. The property should have the name order and the value should be an integer. E.g. For HTML pages:

<PProperty name="order" value="5"/>

Or for Markdown pages:

Property: order, 5