How to edit Sidebar under Sphinx Alabaster theme
Asked Answered
R

2

8

I have the following index.rst file.

Know the cell population of your data
=====================================
Some content

.. toctree::
   :maxdepth: 2

Installation
~~~~~~~~~~~~
.. toctree::
   :maxdepth: 2

   installation

Scripts
~~~~~~~
.. toctree::
   :maxdepth: 2

   scripts

API documentation
~~~~~~~~~~~~~~~~~
.. toctree::
   :maxdepth: 2

   apidoc

Roadmap
~~~~~~~
.. toctree::
   :maxdepth: 2

   roadmap

Indices and Tables
==================
* :ref: `genindex`

Now the sidebar looks like this:

enter image description here

As described in that image. I'd like to do couple of things.

  1. remove the title only in the sidebar but maintaining it in the main page.
  2. add new URL link, but not showing it in the main page like "Indices and Tables"

How can I do that?

Retroactive answered 9/10, 2015 at 2:39 Comment(1)
The documentation for alabaster describes how to overcome these problems now.Symer
R
11

I finally fixed it the following way

In the Sphinx's _template directory create a file called foo.html.

The content may look something like this:

<hr />
<p>
<h2 class='logo'>
<a href="https://foo.bar.com/">Web Version</a>
</h2>
</p>

Finally in conf.py add this:

html_sidebars = {
        '**': [
                 'localtoc.html',
                 'relations.html',
                 'searchbox.html',
                 # located at _templates/
                 'foo.html',
            ]

        }

At the end it looks like this:

enter image description here

Retroactive answered 26/10, 2015 at 7:8 Comment(1)
There's a typo here; the 2nd sentence should say _templates with an 's'.Pitch
B
3

I can propose something for the first question. I'm in no way an expert in CSS so my solution isn't probably the more elegant one, but it works ! Put in your 'source/_static/custom.css' file :

.sphinxsidebar a.reference.internal[href='#'] {
  display: none;
}

Maybe a CSS expert should give a better selector …

Bucky answered 10/10, 2015 at 18:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.