From 3dcf284c83cb4a924f15d747a0ded7272e8347b1 Mon Sep 17 00:00:00 2001 From: Andrey Kurilin Date: Tue, 3 Nov 2020 16:25:38 +0200 Subject: [PATCH] Add an option to include or not the links to parents at nav bar This PR introduces new theme config option 'nav_bar_display_parents' that takes control of diplaying links to parent documents (in terms of TOC) at navigation bar. Changes to default behavior: * nothing is changes, since the default value is True --- sphinx_material/sphinx_material/relbar.html | 8 +++++--- sphinx_material/sphinx_material/theme.conf | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sphinx_material/sphinx_material/relbar.html b/sphinx_material/sphinx_material/relbar.html index d8b680717..281f9cc81 100644 --- a/sphinx_material/sphinx_material/relbar.html +++ b/sphinx_material/sphinx_material/relbar.html @@ -11,9 +11,11 @@ {% set localhref=pathto( item.href ) if item.internal else item.href|e %}
  • {{ item.title }}
  • {%- endfor %} - {%- for parent in parents %} -
  • {{ parent.title }}
  • - {%- endfor %} + {%- if theme_nav_bar_display_parents %} + {%- for parent in parents %} +
  • {{ parent.title }}
  • + {%- endfor %} + {%- endif %} diff --git a/sphinx_material/sphinx_material/theme.conf b/sphinx_material/sphinx_material/theme.conf index 8d4fb59cf..6fcd11fa6 100644 --- a/sphinx_material/sphinx_material/theme.conf +++ b/sphinx_material/sphinx_material/theme.conf @@ -85,6 +85,9 @@ master_doc = True # internal: Flag indicating to use pathto (bool) nav_links = +# Include links of parent documents at navigation bar +nav_bar_display_parents = True + # Text to appear at the top of the home page in a "hero" div. Must be a # dict[str, str] of the form pagename: hero text, e.g., {'index': 'text on index'} heroes =