Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing the Edit on Github link when using Read The Docs & Sphinx with ReadTheDocs Theme

I'm trying to find out how to use the _template overrides option in Sphinx to override the default ReadTheDocs theme for hosting Sphinx documentation on http://readthedocs.org.

Specifically, I'm wanting to remove/hide the "Edit on Github" link shown in the upper right hand corner of this theme.

Any tips would be greatly appreciated! Thanks!

I've reviewed the documentation here: http://www.sphinx-doc.org/en/stable/templating.html, however, I'm stumped and really need some help.

Thank you!

like image 737
Brian King Avatar asked Dec 08 '22 23:12

Brian King


1 Answers

Okay, I figured it out so I'll answer my own inquiry in hopes to assist others.

Assuming you're using the ReadTheDocs default theme this should work just fine.

  • Clone the ReadTheDocs theme from the Github repo to your computer. (https://github.com/snide/sphinx_rtd_theme/)
  • Locate breadcrumbs.html file (https://github.com/snide/sphinx_rtd_theme/blob/master/sphinx_rtd_theme/breadcrumbs.html)
  • Add breadcrumbs.html file to your Sphinx documentation folder in the _templates folder. If this directory doesn't yet exist you'll need to create it.
  • In your conf.py file locate your html_context section, if you do not already have this, you can create it. (Sample linked below).

    html_context = { "display_github": False, # Add 'Edit on Github' link instead of 'View page source' "last_updated": True, "commit": False, }

  • Add the breadcrumbs.html file to your tracked files using Git

  • Commit the changes to your conf.py
  • Push to remote Github repo
  • Profit

References

  • https://github.com/duelingdogs/dueling-docs/blob/master/source/conf.py#L36-L40
  • http://help.duelingdogs.net/en/latest/ (Example showing that the Edit on Github option is now removed.
like image 56
Brian King Avatar answered Dec 28 '22 06:12

Brian King