1
0
mirror of https://github.com/thangisme/notes.git synced 2025-01-03 04:36:33 -05:00

Update navigation-structure.md

Adjusted the documentation to explain how mixtures of numbers and strings are treated by `nav_order`.
This commit is contained in:
PLanCompS 2020-08-11 20:47:22 +02:00
parent e4759daecf
commit cff0254d93

View File

@ -25,7 +25,7 @@ By default, all pages will appear as top level pages in the main nav unless a pa
## Ordering pages ## Ordering pages
To specify a page order, use the `nav_order` parameter in your pages' YAML front matter. To specify a page order, you can use the `nav_order` parameter in your pages' YAML front matter.
#### Example #### Example
{: .no_toc } {: .no_toc }
@ -38,12 +38,13 @@ nav_order: 4
--- ---
``` ```
The specified `nav_order` parameters on a site should be all integers or all strings. The parameter values determine the order of the top-level pages, and of child pages with the same parent. You can reuse the same parameter values (e.g., integers starting from 1) for the child pages of different parents.
Pages without a `nav_order` parameter are ordered alphabetically by their `title`,
and appear after the explicitly-ordered pages at each level. The parameter values can be numbers (integers, floats) and/or strings. When you omit `nav_order` parameters, they default to the titles of the pages, which are ordered alphabetically. Pages with numerical `nav_order` parameters always come before those with strings or default `nav_order` parameters. If you want to make the page order independent of the page titles, you can set explicit `nav_order` parameters on all pages.
By default, all Capital letters are sorted before all lowercase letters;
adding `nav_sort: case_insensitive` in the configuration file ignores case By default, all Capital letters come before all lowercase letters; you can add `nav_sort: case_insensitive` in the configuration file to ignore the case). Enclosing strings in quotation marks is optional.
when sorting strings (but also sorts numbers lexicographically: `10` comes before `1`).
> *Note for users of previous versions:* `nav_sort: case_insensitive` previously affected the ordering of numerical `nav_order` parameters: e.g., `10` came before `2`. Also, all pages with explicit `nav_order` parameters previously came before all pages with default parameters.
--- ---
@ -62,6 +63,8 @@ nav_exclude: true
--- ---
``` ```
Pages with no `title` are automatically excluded from the navigation.
--- ---
## Pages with children ## Pages with children