{# Adapted from sphinx_rtd_theme/layout.html #}
<h3><a href="{{ pathto(master_doc) }}">{{ _('Table Of Contents') }}</a></h3>
{#
  The singlehtml builder doesn't handle this toctree call when the
  toctree is empty. Skip building this for now.
#}
{% if theme_global_toc and 'singlehtml' not in builder %}
  {% set global_toc = toctree(maxdepth=theme_navigation_depth|int, collapse=theme_collapse_navigation, includehidden=True) %}
{% endif %}
{% if global_toc %}
  {{ global_toc }}
{% else %}
  {# local toc #}
  {{ toc }}
{% endif %}
