From 59072440ab4e44b3e14d3cf6069751e28161503b Mon Sep 17 00:00:00 2001 From: Major Hayden Date: Tue, 16 Aug 2016 10:10:37 -0500 Subject: [PATCH] Allow automatic toc to be disabled In some cases, a user may want to disable the automatic table of contents generation in the body of the page. This patch adds a ``display_toc`` option into the theme options list that will disable the automatic TOC in the documentation body. Closes-Bug: 1613761 Change-Id: I508b46c5ba6a022ee4ad2687cb4e44ed449ca4fe --- .../theme/openstackdocs/localtoc.html | 4 +--- openstackdocstheme/theme/openstackdocs/theme.conf | 1 + ...low-disabling-toc-in-body-d98d3a6e633fa28e.yaml | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/allow-disabling-toc-in-body-d98d3a6e633fa28e.yaml diff --git a/openstackdocstheme/theme/openstackdocs/localtoc.html b/openstackdocstheme/theme/openstackdocs/localtoc.html index 5eb9b893..aaaeae46 100644 --- a/openstackdocstheme/theme/openstackdocs/localtoc.html +++ b/openstackdocstheme/theme/openstackdocs/localtoc.html @@ -1,6 +1,4 @@ -{%- if theme_sidebar_mode == 'toctree' %} -{%- if display_toc %} +{%- if theme_sidebar_mode == 'toctree' and theme_display_toc %}
Contents
{{ toc }} {%- endif %} -{%- endif %} diff --git a/openstackdocstheme/theme/openstackdocs/theme.conf b/openstackdocstheme/theme/openstackdocs/theme.conf index 85854ffc..42730f59 100644 --- a/openstackdocstheme/theme/openstackdocs/theme.conf +++ b/openstackdocstheme/theme/openstackdocs/theme.conf @@ -6,3 +6,4 @@ pygments_style = native [options] analytics_tracking_code = UA-17511903-1 sidebar_mode = toctree +display_toc = True diff --git a/releasenotes/notes/allow-disabling-toc-in-body-d98d3a6e633fa28e.yaml b/releasenotes/notes/allow-disabling-toc-in-body-d98d3a6e633fa28e.yaml new file mode 100644 index 00000000..5eba8b25 --- /dev/null +++ b/releasenotes/notes/allow-disabling-toc-in-body-d98d3a6e633fa28e.yaml @@ -0,0 +1,14 @@ +--- +features: + - | + The automatic table of contents that appears in the body of the + documentation can be disabled by setting ``display_toc`` to ``False`` in + the ``html_theme_options`` option in ``conf.py``. + + For example: + + .. code-block:: python + + html_theme_options = { + "display_toc": False, + }