New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Safe page sorting #411
Safe page sorting #411
Conversation
Display of grandchildren links in the navigation is now delayed until their parent is selected. To test, select the `Grandchildren test` node. Only the direct children should appear. Selecting one of them then shows its children.
Trying to get the navigation to remain in the forked site
Trying to get the navigation to remain in the forked site
Trying to get the navigation to remain in the forked site
Trying to get the navigation to remain in the forked site
Added `.jekyll-cache`
Pages with `nav_exclude: true` were included when sorting on `title` or `nav_order`. That could cause build failures when the type of value of the field differs from that on other pages, as reported in just-the-docs#406. Pages with `nav_exclude: true` or no `title` are never displayed in the navigation, so removing them from `pages_list` cannot break existing sites. This change also allows the removal of some tests in the code. (The indentation of the code should now be adjusted, but that has been deferred, to restrict the size of the diff for review.) For testing, the title of `404.html` has been changed to the number `404`, the page `docs/untitled-test.md` has been added, and `nav_sort_order` has been set to `case_sensitive`. Those updates give build failures with the current version of `_includes/nav.html`, but not after the suggested changes. It will still be possible for build failures to occur due to sorting fields of *non-excluded* pages with differing types of values (e.g., `nav_order`a mixture of numbers and strings). To make the code completely safe will require relatively complicated changes,.
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`.
Indentation adjusted
Adjusted the documentation to explain how mixtures of numbers and strings are treated by `nav_order`.
Fixed conversion of numeric titles to strings.
Clarifications
See the change to `_config.yml` for how to activate the tests.
@pmarsceill the Liquid code in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is amazing... The tests are a great idea.
@pdmosses could you resolve the conflicting file from the |
@pmarsceill I'll take a look now, and let you know. |
Apparetnly Jekyll's `include` config option cannot be used to override an `exclude`, so activating `docs/tests/` requires commenting-out that line in the `exclude` list.
Reinstated the collapsible TOC at the top, to support the reference to it right at the end of the file. (The `TOC` feature can only be used once per page, so this is the only way of illustrating the rendering of the collapsible TOC in the docs.)
url corrected
doc for turning on kramdown linenos globally corrected/
@pmarsceill I've updated I've also updated And finally, I've reinstated the collapsible TOC at the top of the
|
@pmarsceill the commit option on the requested change disappeared due to my independent commit, but the change request is still there... I hope it doesn't block merging. Apologies for my lack of expertise with updating PRs. |
Currently, the values of
nav_order
fields are required to be uniformly all numbers or all strings. If different types of values are (accidentally) used, building fails, with a somewhat confusing error report (e.g., see issue #406).The changes to
_includes/nav.html
eliminate the possibility of such build failures arising. They also preventnav_sort: case_insensitive
affecting the ordering of numericalnav_order
parameters (where10
came before2
!). And they make it possible to use numbers to order some pages, and strings to order others.The PR adds tests for various navigation features. These are excluded by default, and can be activated by commenting-out a line in
_config.yml
. (The tests inherently involve mixtures of different types of values fornav_order
fields, so they cannot be used with previous versions of_includes/nav.html
.)This PR incorporates the bug fixes of PR #407 regarding
nav_exclude
and pages with numeric titles.