From 3303d22b0c8bf64e25f11046c380c022f07dfbd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20E=2E=20S=C3=B8rensen?= Date: Sat, 11 Mar 2023 11:53:06 +0100 Subject: [PATCH] Introduce `navigation_startdepth` parameter Allows users to start the sidebar Toc at level 0 Addresses issue #1181 --- docs/conf.py | 1 + src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html | 1 + src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf | 1 + 3 files changed, 3 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index be25b184c..fda1120b5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -145,6 +145,7 @@ "navbar_align": "left", # [left, content, right] For testing that the navbar items align properly "navbar_center": ["version-switcher", "navbar-nav"], "announcement": "https://raw.githubusercontent.com/pydata/pydata-sphinx-theme/main/docs/_templates/custom-template.html", + "navigation_startdepth": 0, # "show_nav_level": 2, # "navbar_start": ["navbar-logo"], # "navbar_end": ["theme-switcher", "navbar-icon-links"], diff --git a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html index ca3b36876..d133439c8 100644 --- a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html +++ b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html @@ -10,6 +10,7 @@ {# Create the sidebar links HTML here to re-use in a few places #} {# If we have no sidebar links, pop the links component from the sidebar list #} {%- set sidebar_nav_html = generate_toctree_html("sidebar", +startdepth=theme_navigation_startdepth|int, show_nav_level=theme_show_nav_level|int, maxdepth=theme_navigation_depth|int, collapse=theme_collapse_navigation|tobool, diff --git a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf index 7105d124e..9d05244cf 100644 --- a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf +++ b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf @@ -25,6 +25,7 @@ search_bar_text = Search the docs ... search_bar_position = sidebar navigation_with_keys = True collapse_navigation = False +navigation_startdepth = 1 navigation_depth = 4 show_nav_level = 1 show_toc_level = 1