From f81f3344076a09482545534e014318d7e961f825 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Mon, 18 Jan 2016 12:49:55 +0100 Subject: [PATCH] Hide duplicate titles and empty tocs in generated content At the moment we have two h1 titles, in the content generated by Sphinx and in the titlerow.html file. This change will hide the h1 title in the generated content. At the moment the title of a document is displayed in the local toc. This change will hide the title of a document in the local toc. At the moment the local toc is also displayed when it only contains the title of the document. This change will not display the local toc if it conly contains the title of the document. http://lists.openstack.org/pipermail/openstack-docs/2016-January/008180.html Change-Id: I48b923a67010c92945c46ab00de0b090ba7cd465 --- .../theme/openstackdocs/layout.html | 3 +-- .../theme/openstackdocs/localtoc.html | 4 ++++ .../openstackdocs/static/css/combined.css | 18 +++++++++++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 openstackdocstheme/theme/openstackdocs/localtoc.html diff --git a/openstackdocstheme/theme/openstackdocs/layout.html b/openstackdocstheme/theme/openstackdocs/layout.html index b4c87cca..62a34bed 100644 --- a/openstackdocstheme/theme/openstackdocs/layout.html +++ b/openstackdocstheme/theme/openstackdocs/layout.html @@ -39,8 +39,7 @@ ga('send', 'pageview');
-
Contents
- {{ toc }} +{% include 'localtoc.html' %}
{% block body %}{% endblock %} diff --git a/openstackdocstheme/theme/openstackdocs/localtoc.html b/openstackdocstheme/theme/openstackdocs/localtoc.html new file mode 100644 index 00000000..cccd5e36 --- /dev/null +++ b/openstackdocstheme/theme/openstackdocs/localtoc.html @@ -0,0 +1,4 @@ +{%- if display_toc %} +
Contents
+{{ toc }} +{%- endif %} diff --git a/openstackdocstheme/theme/openstackdocs/static/css/combined.css b/openstackdocstheme/theme/openstackdocs/static/css/combined.css index d3b79291..5c6a0ca9 100644 --- a/openstackdocstheme/theme/openstackdocs/static/css/combined.css +++ b/openstackdocstheme/theme/openstackdocs/static/css/combined.css @@ -4127,7 +4127,7 @@ a.docs-edit i { .docs-top-contents ul { list-style: none; padding: 3px; - margin: 0 0 0 10px; } + margin: 0 0 5px 0; } .docs-top-contents ul li a { text-decoration: underline; } @@ -4641,3 +4641,19 @@ table.highlighttable { padding-left: 0px; margin-left: 20px; } + +.docs-body .section h1 { + display: none; +} + +.docs-top-contents a[href="#"] { + display: none; +} + +.docs-top-contents h5 { + margin-bottom: 10px; +} + +.docs-top-contents { + padding: 10px; +}