From cfbdee11682be1cf1b6358605cbbc2abb4c607e8 Mon Sep 17 00:00:00 2001 From: PLanCompS <18308236+pdmosses@users.noreply.github.com> Date: Thu, 13 Aug 2020 16:47:58 +0200 Subject: [PATCH] Update nav.html Fixed conversion of numeric titles to strings. --- _includes/nav.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/_includes/nav.html b/_includes/nav.html index a6fd87e..a70e2b0 100644 --- a/_includes/nav.html +++ b/_includes/nav.html @@ -23,7 +23,7 @@ {%- comment -%} The nav_ordered_pages have to be added to number_ordered_pages and string_ordered_pages, depending on the nav_order value. - The first character of jsonify is `"` only for strings. + The first character of the jsonify result is `"` only for strings. {%- endcomment -%} {%- assign nav_ordered_groups = nav_ordered_pages | group_by_exp:"item", "item.nav_order | jsonify | slice: 0" -%} @@ -39,12 +39,13 @@ {%- assign sorted_number_ordered_pages = number_ordered_pages | sort:"nav_order" -%} {%- comment -%} - The string_ordered_pages have to be sorted by nav_order, and otherwise title. + The string_ordered_pages have to be sorted by nav_order, and otherwise title + (where appending the empty string to a numeric title converts it to a string). After grouping them by those values, the groups are sorted, then the items of each group are concatenated. {%- endcomment -%} {%- assign string_ordered_groups = string_ordered_pages - | group_by_exp:"item", "item.nav_order | default: item.title | string" -%} + | group_by_exp:"item", "item.nav_order | default: item.title | append:''" -%} {%- if site.nav_sort == 'case_insensitive' -%} {%- assign sorted_string_ordered_groups = string_ordered_groups | sort_natural:"name" -%} {%- else -%}