Skip to content

Conversation

@pdmosses
Copy link
Contributor

Implement #569, based on #448.

Setting nav_fold: true for a just_the_docs collection makes it appear like a folded top-level navigation element. Its navigation is unfolded when any page in the collection is active.

To test locally, use the jekyll option --config _config.yml,_config_dev.yml,_tests.yml.

- Move `docs/tests` pages to `_tests` collection.
- Create `_tests_config.yml` to include tests.
- Update `_cnfig.yml` instructions for including tests.
- Update links in `_tests/navigation/index.md`.
- Update `_layout/default.html` to output site.html_pages and/or collections.
- Test by running `bundle exec jekyll serve --config _tests_config.yml`.
- Discount excluded pages
- Update the section on configuration of collections to include normal pages.
- Avoid irrelevant conflicts when updating from master
- Remove duplicated configuration code from `_tests_config.yml`
- Rename to `_tests.yml`
The tests collection is ignored when not mentioned, so it does not need to be excluded in `_config.yml`.
- Fix a bug with the breadcrumbs list, where a link on a grandchild page can point to the wrong parent page, following the solution suggested by @AdityaTiwari2102 in just-the-docs#477
The TOC/breadcrumb links in "Tests" and "Test Collection 1" exhibit the bug reported in just-the-docs#492. To fix the bug, this PR needs merging with just-the-docs#494.
Serve locally:
```
bundle exec jekyll serve --config _config.yml,_config_dev.yml
```
Test locally:
```
bundle exec jekyll serve --config _config.yml,_config_dev.yml,_tests.yml
```
- Fix a bug that affects sites with no child pages
- Relax version constraints in response to failing check
  `Could not find gem 'bundler (~> 2.1.4)' in any of the relevant sources`
- Cover all combinations of `search_exclude` and `nav_exclude` in `_tests.yml` Searching for C2 and C4  should return results, C1 and C5 not.
Navigation for pages, C1, C2, C3 should appear, C4 and C5 not.
Manually merge the relevant changes from PR just-the-docs#494, namely:

When configured for more than one collection, v0.3.2 produces empty TOCs of children in all but the last collection, due to referencing the overwritten `pages_list` in `_layouts/default.html`. When the same parent title is used in different collections, v0.3.2 can also produce a link to the wrong collection. Moreover, v0.3.3  can also produce incorrect breadcrumb links; see issue just-the-docs#492.

- Move the breadcrumbs link variable assignments from `_layouts/default.html` to `_includes/nav.html`, and make it conditional on `page` being in the current collection.

- Correct the condition for assignment to `second_level_url`, as in just-the-docs#477.

- Change the variable used for the TOC from `children_list` to `toc_list`, move its assignment from `_layouts/default.html` to `_includes/nav.html`, and make it conditional on `page` being in the current collection.
Setting `nav_fold: true` for a `just_the_docs` collection makes it appear like a folded top-level navigation element.
Its navigation is unfolded when any page in the collection is active.
@pdmosses pdmosses linked an issue Feb 16, 2021 that may be closed by this pull request
@pdmosses pdmosses mentioned this pull request Feb 22, 2021
@pdmosses pdmosses mentioned this pull request May 8, 2021
mattxwang added a commit that referenced this pull request Jul 4, 2022
This PR combines (and resolves conflicts between) #448, #463, #466, #494, #495, #496, #498, and #572. 

The main aim is to facilitate use of several of the implemented features _together_, when using the fork as a remote theme. It should also simplify merging the included PRs into a future release.

The branch [combination-rec-nav](https://github.com/pdmosses/just-the-docs/tree/combination-rec-nav) adds [multi-level navigation](#462) and (NEW:) [sibling links](#394) to the branch used for this PR. It includes updated [documentation for the navigation structure](https://pdmosses.github.io/just-the-docs/docs/navigation-structure/), and reorganised and extended [navigation tests](https://pdmosses.github.io/just-the-docs/tests/navigation/). The documentation and the tests can be browsed at the (temporary) [website published from the combination-rec-nav branch](https://pdmosses.github.io/just-the-docs/).

_Caveat:_ The changes to v0.3.3 in this PR and #462 have not yet been reviewed or approved, and may need updating before merging into a release of the theme. If you use a branch from a PR as a remote theme, there is a risk of such updates affecting your website. Moreover, these branches are likely to be deleted after they have been merged. To avoid  such problems, you could copy the branch that you want to use to your own fork of the theme.

Co-authored-by: Matt Wang <[email protected]>
@mattxwang
Copy link
Member

Going to close as we've merged in #578; @pdmosses feel free to reopen if necessary!

@mattxwang mattxwang closed this Jul 4, 2022
@pdmosses pdmosses deleted the pages-and-folded-collections branch November 3, 2022 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support collection navigation folding

2 participants