Fix incorrect disambiguation in generated TOCs (#999)

The regression tests in https://just-the-docs.github.io/just-the-docs-tests/navigation/grandparent/index/ include a section "A grandchild with the same parent title as a child or top-level page". Its last item fails, as can currently be seen at https://just-the-docs.github.io/just-the-docs-tests/navigation/grandparent/f/ : the first occurrence of `G` links to the grandchild of `E`., and shouldn't be included.

The regression can be fixed by changing `where: "grand_parent", page.parent` to `where_exp: "item", "item.grand_parent == page.parent"`. This should be apparent  when running the regressions tests with this PR branch as remote theme.

The two filters give the same results in Jekyll 4, but not in Jekyll 3. It seems that this was overlooked because the sanity-testing of v0.4.0.rc3 was inadvertently using Jekyll 4.2.2.
This commit is contained in:
Peter Mosses 2022-10-14 22:15:25 +02:00 committed by GitHub
parent e269960fa8
commit 7c124a210a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -227,7 +227,7 @@
{%- if page.has_children == true and page.has_toc != false -%}
{%- assign toc_list = pages_list
| where: "parent", page.title
| where: "grand_parent", page.parent -%}
| where_exp: "item", "item.grand_parent == page.parent" -%}
{%- if page.child_nav_order == "desc" -%}
{%- assign toc_list = toc_list | reverse -%}
{%- endif -%}