Feature: Generate navigation hierarchy from page urls #1588
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Close #1570
Add the configuration option
nav_urls
and the page optionnav_fold
to multi-level navigation.Configuration option
nav_urls
When
nav_urls == true
:parent
,grand_parent
,ancestor
The navigation hierarchy is unaffected by adding the configuration option
permalink: pretty
.Note
Each url level with child pages requires a parent page in the main navigation.
Front matter option
nav_fold
By default, top-level pages with child pages are initially displayed folded. For collections, there is an option
nav_fold
with default valuetrue
: whenfalse
, the top level of the collection navigation is unfolded to display links to the top-level pages in the collection. Now, whennav_fold: false
is added in the front matter of a parent page, it is initially displayed unfolded.Most pages on the theme website have urls of the form
/docs/*
. The parent page for that level is added at/docs/index.md
; it could alternatively be added at/docs.md
. To ensure that links to the top-level pages in thedocs
folder are visible on the theme home page, the added parent page front matter includesnav_fold: false
.(The existing theme docs pages have not yet been updated to explain the configuration and use of the
nav_urls
option.)Acknowledgment
The implementation of this feature is based on the modifications of
just-the-docs@v0.5.0
reported by @EricFromCanada in discussion #583.Testing
To test this PR, use
theme: just-the-docs
in _config.yml and the following in yourGemfile
:Preliminary local testing includes the Just the Docs theme website and the Just the Docs Tests website, as well as the company manual website referenced in #583.1
Warning
This PR has not yet been throughly tested or reviewed, and may change!
Footnotes
The pages of the company manual website are pure Markdown, with no front matter markup at all. Various (safe) Jekyll plugins allow the omission of the page
title
andlayout
fields. ↩