Separate sorting of numbers and strings for navigation order

The values of `title` and `nav_order` can be numbers or strings.
Jekyll gives build failures when sorting on mixtures of different types,
so numbers and strings need to be sorted separately.

Here, numbers are sorted by their values, and come before all strings.
An omitted `nav_order` value is equivalent to the page's `title` value
(except that a numerical `title` value is treated as a string).

The case-sensitivity of string sorting is determined by `site.nav_sort`.
This commit is contained in:
PLanCompS
2020-08-11 18:25:58 +02:00
parent 83ec553348
commit 4fc59a578f
4 changed files with 63 additions and 9 deletions

11
docs/tests/42.md Normal file
View File

@@ -0,0 +1,11 @@
---
layout: default
title: 42
search_exclude: true
---
# The answer is 42
A link to this page should appear in the navigation after all pages where
the `nav_order` value is a number, because titles are treated as strings
when used as default `nav_order`s.