Render pages with no sidebar/toctree at all?

331 views
Skip to first unread message

Barbara Snyder

unread,
Aug 6, 2018, 5:34:45 PM8/6/18
to sphinx-users
I have searched high and low for this info and just can't find it.

We are using a customized alabaster theme and are playing with a re-org of our docs that would replace the need for a toctree in the sidebar. I would like to remove the sidebar completely, so the text of an HTML page is the full width of the browser window. I have commented out everything I can find related to sidebars, but it is still there. I even tried setting it to 1 pixel in width, but nothing has changed.

How can I tell sphinx to not include the sidebar at all?

Thanks -- Barbara

Pablo Coberly

unread,
Aug 9, 2018, 8:30:56 AM8/9/18
to sphinx-users
I did this by customising layout.html with a condition check:

{%- if pagename != "index" and pagename != "search" %}
{%- block sidebar1 %}
    
        {%- for sidebartemplate in sidebars %}
        {%- include sidebartemplate %}
        {%- endfor %}

{% endblock %}
{%- endif %}

Stephan K

unread,
Nov 8, 2018, 11:42:21 AM11/8/18
to sphinx-users
Hi Barbara,

I was able to achieve exactly this by adding the following to my conf.py file:

html_theme_options = {
    # Disable showing the sidebar. Defaults to 'false'
    'nosidebar': True,
}

(tested with alabaster theme)

Hope that helps!


On Monday, August 6, 2018 at 11:34:45 PM UTC+2, Barbara Snyder wrote:
Reply all
Reply to author
Forward
0 new messages