title: How do I include the homepage in the Sphinx TOC?
body: <p>Let’s say I’ve got a Sphinx project with the following sources:</p>
  
  <pre><code>index.rst
  installation.rst
  templating/
      index.rst
      module.rst
      fieldtype.rst
  </code></pre>
  
  <p>index.rst (the homepage) has the following TOC tree:</p>
  
  <pre><code>.. toctree::
     :titlesonly:
  
     installation
     templating/index
  </code></pre>
  
  <p>I want my template to include a sidebar that lists all 3 top-level pages (homepage, installation, templating/index).</p>
  
  <p>I've tried adding a second, hidden TOC tree in the homepage:</p>
  
  <pre><code>.. toctree::
     :hidden:
  
     index
  
  .. toctree::
     :titlesonly:
  
     installation
     templating/index
  </code></pre>
  
  <p>That actually gives me the desired result, <em>except</em> that it makes the <code>next</code> variable set to the current page. So this code in my template:</p>
  
  <pre><code>Next up: &lt;a href="{{ next.link }}"&gt;{{ next.title }}&lt;/a&gt;
  </code></pre>
  
  <p>…always outputs the homepage link from the homepage. No good.</p>
  
  <p>I’ve always tried to hardcode the actual homepage link right into the sidebar of the template:</p>
  
  <pre><code>{% set homeClass = 'current' if pagename == 'index' else '' %}
  &lt;ul class="{{ homeClass }}"&gt;
      &lt;li class="toctree-l1 {{ homeClass }}"&gt;&lt;a class="{{ homeClass }} reference internal" href="/index.html"&gt;Home&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  {{ toctree() }}
  </code></pre>
  
  <p>That also works, except that I don’t want to force the docs to be accessed on the webroot of a web server – I want them to work from the file system too.</p>
  
  <p>I can’t simply set the URL to “index.html” because that won’t work when you’re in a file within templating/.</p>
  
  <p>Am I missing something obvious? There must be a way to get the homepage into the TOC, without breaking <code>next</code> links and with a dynamic path that works on a local file system, even from within subfolders.</p>