Skip to content
Snippets Groups Projects
Commit cfbdee11 authored by PLanCompS's avatar PLanCompS
Browse files

Update nav.html

Fixed conversion of numeric titles to strings.
parent cff0254d
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
{%- comment -%} {%- comment -%}
The nav_ordered_pages have to be added to number_ordered_pages and The nav_ordered_pages have to be added to number_ordered_pages and
string_ordered_pages, depending on the nav_order value. 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 -%} {%- endcomment -%}
{%- assign nav_ordered_groups = nav_ordered_pages {%- assign nav_ordered_groups = nav_ordered_pages
| group_by_exp:"item", "item.nav_order | jsonify | slice: 0" -%} | group_by_exp:"item", "item.nav_order | jsonify | slice: 0" -%}
...@@ -39,12 +39,13 @@ ...@@ -39,12 +39,13 @@
{%- assign sorted_number_ordered_pages = number_ordered_pages | sort:"nav_order" -%} {%- assign sorted_number_ordered_pages = number_ordered_pages | sort:"nav_order" -%}
{%- comment -%} {%- 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 After grouping them by those values, the groups are sorted, then the items
of each group are concatenated. of each group are concatenated.
{%- endcomment -%} {%- endcomment -%}
{%- assign string_ordered_groups = string_ordered_pages {%- 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' -%} {%- if site.nav_sort == 'case_insensitive' -%}
{%- assign sorted_string_ordered_groups = string_ordered_groups | sort_natural:"name" -%} {%- assign sorted_string_ordered_groups = string_ordered_groups | sort_natural:"name" -%}
{%- else -%} {%- else -%}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment