Skip to content
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

add sidebar nav instructions to documentation #476

Closed
1 of 5 tasks
bquast opened this issue Aug 24, 2016 · 8 comments
Closed
1 of 5 tasks

add sidebar nav instructions to documentation #476

bquast opened this issue Aug 24, 2016 · 8 comments

Comments

@bquast
Copy link

bquast commented Aug 24, 2016

  • This is a question about using the theme.
  • I believe this to be a bug with the theme --- not Jekyll, GitHub Pages or one of the bundled plugins.
  • This is a feature request.
  • I have updated all gems with bundle update.
  • I have tested locally with bundle exec jekyll build.

Environment informations

  • Minimal Mistakes version: 3.4.3
  • github-pages

Expected behavior

@mmistakes
Copy link
Owner

mmistakes commented Aug 24, 2016

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"

@bquast
Copy link
Author

bquast commented Aug 24, 2016

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.

http://qua.st/rnn/docs/quick-start-guide/

@mmistakes
Copy link
Owner

@bquast
Copy link
Author

bquast commented Aug 31, 2016

very cool, thanks a lot!

@bquast
Copy link
Author

bquast commented Sep 20, 2016

I just went through the documentation, I believe the step about making a collection is missing.

@mmistakes
Copy link
Owner

@bquast Didn't include that as collection creation is a basic of using Jekyll that can be learned about from the official docs.

@bquast
Copy link
Author

bquast commented Sep 20, 2016

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.

@mmistakes
Copy link
Owner

Sidebar nav should work with posts and pages, not just collections.

AmeeKang added a commit to AmeeKang/AmeeKang.github.io that referenced this issue Feb 12, 2021
AmeeKang added a commit to AmeeKang/AmeeKang.github.io that referenced this issue Feb 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants