Closed bquast closed 8 years ago
Currently undocumented because I built it as a "one off" for the theme's documentation section. Wasn't really meant to be something as part of the theme as it's not the most straight forward thing to do.
It involves manually listing out all of the links in a _data
file and then referencing that set of navigation links with sidebar.nav.Name
in the YAML Front Matter of whatever post/page/collection you want it to appear on.
For example, the menu for the theme's documentation was built by:
_data/navigation.yml
# documentation links
docs:
- title: Getting Started
children:
- title: "Quick-Start Guide"
url: /docs/quick-start-guide/
- title: "Structure"
url: /docs/structure/
- title: "Installation"
url: /docs/installation/
- title: "Upgrading"
url: /docs/upgrading/
- title: Customization
children:
- title: "Configuration"
url: /docs/configuration/
- title: "Navigation"
url: /docs/navigation/
- title: "UI Text"
url: /docs/ui-text/
- title: "Authors"
url: /docs/authors/
- title: "Layouts"
url: /docs/layouts/
- title: Content
children:
- title: "Working with Posts"
url: /docs/posts/
- title: "Working with Pages"
url: /docs/pages/
- title: "Working with Collections"
url: /docs/collections/
- title: "Helpers"
url: /docs/helpers/
- title: "Utility Classes"
url: /docs/utility-classes/
- title: Extras
children:
- title: "Stylesheets"
url: /docs/stylesheets/
- title: "JavaScript"
url: /docs/javascript/
- title: Meta
children:
- title: "History"
url: /docs/history/
- title: "Contributing"
url: /docs/contributing/
- title: "Old 2.2 Docs"
url: /docs/docs-2-2/
- title: "License"
url: /docs/license/
- title: "Terms & Privacy Policy"
url: /terms/
And then in each _doc
collection page the following was added to the YAML Front Matter to pull in the navigation in the sidebar.
sidebar:
nav: "docs"
The better solution for adding the same YAML to multiple pages is with Front Matter Defaults in _config.yml
like so:
defaults:
# _docs
- scope:
path: ""
type: docs
values:
sidebar:
nav: "docs"
Thanks a lot. I had figured out the part about _config.yml
but for some reason I didn't think to look at navigation.yml
, which of course is a logical place.
I am making a minisite to accompany my recurrent neural network package which means adding a lot of documentation so this is perfect.
Documentation has been added https://mmistakes.github.io/minimal-mistakes/docs/layouts/#custom-sidebar-navigation-menu
very cool, thanks a lot!
I just went through the documentation, I believe the step about making a collection is missing.
@bquast Didn't include that as collection creation is a basic of using Jekyll that can be learned about from the official docs.
Ok I agree. I guess I meant to say that people might not realise that the files need to a collection for the sidebar nav to work, maybe in a note or something. Or perhaps this is obvious to people who use jekyll more frequently than I do.
Sidebar nav should work with posts and pages, not just collections.
bundle update
.bundle exec jekyll build
.Environment informations
github-pages
Expected behavior