Skip to content

Best-practices for sidebar management #322

@rossbar

Description

@rossbar

While converting the numpydoc documentation over to the pydata-sphinx-theme, we encountered the following scenario:

numpydoc's documentation has a "flat" structure - namely, only the master_doc (index.rst) has a .. toctree that refers to every other document. This means that the left sidebar, which is based on the toctree in the given doc, will always be empty.

My first thought was that, since it will always be empty, we could to remove the dead space and allow the content to use the full width (see #146). However, even after #263 it doesn't seem that there's a way to completely get rid of the left sidebar and allow the central content to use the full page width.

My second thought was that we could actually replace the content of the left sidebar with that of the right sidebar, which summarizes the intra-document structure. This turned out to work well (see numpy/numpydoc@0fd8506), but in order to suppress the right sidebar (which is now redundant) I had to add the :notoc: metadata to each file. This latter step felt kind of hacky because a) it's undocumented, so I'm not sure it's intended to be relied upon and b) it requires adding metadata to each source file.

I mostly wanted to raise the issue to illustrate the use-case and see if there were any other suggestions for how to handle this. I like the outcome of the sidebar-swapping solution, but I wasn't sure that this was going to be a viable option moving forward. If a config option were added to control the right sidebar at the project level (e.g. show_right_sidebar=<bool>), then I think this would be a nice solution and potentially worth documenting for other smaller projects with toctree-less docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions