Skip to content

Conversation

@choldgraf
Copy link
Collaborator

@choldgraf choldgraf commented Mar 3, 2020

This moves the sidebar generation logic into a Python function, instead of using a jinja template for it. It uses a recursive function to build sub-lists for children of a page. It also adds an option to include parents of a page, which sets the foundation for a "sidebar-only" version of the theme.

By default, no behavior will change, but this is the new sidebar code:

  {% set nav = get_nav_object(maxdepth=3) %}
  {{ nav_to_html_list(nav) }}

However, if we use the include_item_names variable then the top-level headers will be included in the sidebar. We can use this along with collapse=False to grab the full-site TOC if we wish:

  {% set nav = get_nav_object(maxdepth=3, collapse=False) %}
  {{ nav_to_html_list(nav, include_item_names=True) }}

results in:

image

As you can see, currently this results in duplicated top-level headers in the sidebar and topbar, but eventually this could be switched on with a sidebar_only config value or something like this, that would then remove the top-bar.

It also reduces a little bit of CSS redundancy (I think) now that we are using SCSS
What do folks think?

@choldgraf
Copy link
Collaborator Author

a friendly ping on this one...I know folks have other fish to fry, but I would appreciate a look at this, since it's a necessary step for me to build off of it in another theme I'm building

@jorisvandenbossche
Copy link
Member

Done in #219

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.

2 participants