From 15ded297b84d728b43056b7e62b97a3912305a00 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Wed, 5 Sep 2018 23:45:42 +0200 Subject: [PATCH] Docs for hidding "On ..." section from versions menu (#4547) This is not a real solution, but currently is the only way of doing this. --- docs/guides/remove-edit-buttons.rst | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/docs/guides/remove-edit-buttons.rst b/docs/guides/remove-edit-buttons.rst index 4d22ff4a7cd..70b4a72b9d9 100644 --- a/docs/guides/remove-edit-buttons.rst +++ b/docs/guides/remove-edit-buttons.rst @@ -2,11 +2,15 @@ Removing "Edit on ..." Buttons from Documentation ================================================= When building your documentation, Read the Docs automatically adds buttons at -the top of your documentation that point readers to your repository to make +the top of your documentation and in the versions menu that point readers to your repository to make changes. For instance, if your repository is on GitHub, a button that says "Edit -on GitHub" is added to your documentation to make it easy for readers to author +on GitHub" is added in the top-right corner to your documentation to make it easy for readers to author new changes. + +Remove links from top-right corner +---------------------------------- + The only way to remove these links currently is to override the Read the Docs theme templates: @@ -22,5 +26,25 @@ The new ``breadcrumbs.html`` should look like this:: {% block breadcrumbs_aside %} {% endblock %} + +Remove "On ..." section from versions menu +------------------------------------------ + +This section can be removed with a custom CSS rule to hide them. +Follow the instructions under :doc:`adding-custom-css` and put the following content into the ``.css`` file: + +.. code-block:: css + + /* Hide "On GitHub" section from versions menu */ + div.rst-versions > div.rst-other-versions > div.injected > dl:nth-child(4) { + display: none; + } + + +.. warning:: + + You may need to change the ``4`` number in ``dl:nth-child(4)`` for a different one in case your project has more sections in the versions menu. + For example, if your project has translations into different languages, you will need to use the number ``5`` there. + Now when you build your documentation, your documentation won't include an edit button or links to the page source.