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
This commit is contained in:
Christian Berendt
2016-01-18 12:49:55 +01:00
parent 41bb08f42d
commit f81f334407
3 changed files with 22 additions and 3 deletions

View File

@@ -39,8 +39,7 @@ ga('send', 'pageview');
<div class="row">
<div class="col-lg-12">
<div class="docs-top-contents">
<h5><a href="{{ pathto(master_doc) }}">Contents</a></h5>
{{ toc }}
{% include 'localtoc.html' %}
</div>
<div class="docs-body">
{% block body %}{% endblock %}

View File

@@ -0,0 +1,4 @@
{%- if display_toc %}
<h5><a href="{{ pathto(master_doc) }}">Contents</a></h5>
{{ toc }}
{%- endif %}

View File

@@ -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;
}