title: How to add captions in Sphinx toctree without adding new documents?
body: <p>Okay, I'm using Sphinx Autosummary to generate documentation for some classes. There are three different types of classes and I want my sidebar to have three distinct sections, like if I was using the :caption: option in the toctree directive.</p>
  
  <p>So I added separated my autosummary directive into three smaller directives, and I put a hidden toctree in between them like so:</p>
  
  <pre><code>
  Section 1
  
  .. toctree::
     :hidden:
     :caption: Section 1
  
  .. autosummary
     :toctree: stubs
  
     myclass
     anotherclass
  
  
  Section 2
  
  .. toctree::
     :hidden:
     :caption: Section 2
  
  .. autosummary::
     :toctree:
  
     thirdclass
  </code></pre>
  
  <p>yields a sidebar like:</p>
  
  <pre><code>myclass
  anotherclass
  thirdclass
  </code></pre>
  
  <p>This doesn't work. The hierarchy of my index.html is exactly how I want it to look, but the sidebar is missing my Captions, they don't show up. When I add a page like <code>self</code> under any of these hidden toctrees, the caption shows up:</p>
  
  <pre><code>
  Section 1
  
  .. toctree::
     :hidden:
     :caption: Section 1
  
     self
  
  .. autosummary
     :toctree: stubs
  
     myclass
     anotherclass
  
  
  Section 2
  
  .. toctree::
     :hidden:
     :caption: Section 2
  
  .. autosummary::
     :toctree:
  
     thirdclass
  </code></pre>
  
  <p>yields a sidebar like:</p>
  
  <pre><code>SECTION 1 (caption)
  Documentation Home
  myclass
  anotherclass
  thirdclass
  </code></pre>
  
  <p>This is what I was looking for, but I don't want to reference <code>self</code> or whatever. I just want the captions. How do I do this?</p>