Skip to content

Add the option for a right sidebar #764

@choldgraf

Description

@choldgraf

This is a suggestion for a new feature...I'd be happy to give a shot at implementing it if folks are interested.

I've found that, with a wide-enough screen, it's helpful to have a sidebar to the right with within-page links. Currently, the RTD theme includes in-page links within the TOC to the left.

In some of my projects, I've got a very small amount of CSS that will pop out the within-page links to the right of the page when the screen is wide-enough. It works something like this:

2019-05-23_11-59-05

I'm wondering if this is something that would be useful as an addition to this theme...maybe something that could be activated w/ a particular configuration? My goal thus far has been to make this possible without modifying any of the HTML - it is a CSS-only modification, something like this:

@media screen and (min-width: 1270px)  {
    /* Pop out the in-page links to the right instead of the left */
    div.wy-side-scroll li.toctree-l1.current > ul {
        position: fixed;
        margin-left: 0px;
        overflow-y: auto;
        padding-left: 5px;
        border-left: 1px solid #767677;
        height: 95%;
        top: 70px;
        left: 1100px;
    }

    div.wy-side-scroll li.toctree-l1.current a {
        border-right: none;
    }

    div.wy-side-scroll li.toctree-l1.current ul {
        max-width: 400px;
    }

    div.wy-side-scroll li.toctree-l1.current ul, li.toctree-l1.current li, li.toctree-l1.current a {
        background-color: transparent !important;
    }

    /* All items should now be visible regardless of expandy state */
    div.wy-side-scroll li.toctree-l1.current ul {
      display: block !important;
    }

    /* hide the expandy buttons */
    div.wy-side-scroll li.toctree-l1.current span.toctree-expand {
        display: none !important;
    }

    /* Make the padding correct */
    div.wy-side-scroll li.toctree-l2 li.toctree-l3 > a {
      padding: .4045em 4.045em !important;
    }

    div.wy-side-scroll li.toctree-l4 > a {
      padding: .4045em 5.663em !important;
  }
}

There are some hacks in there, but I was impressed we could get such a big shift out of a relatively small amount of CSS.

Let me know if folks would be interested in this and I'm happy to discuss changes that would need to be made etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions