You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Help with removing "Edit on Github" option with ReadTheDocs theme #2386
Hi,
you should try to put the following line in your conf.py file
html_show_sourcelink = False
I've no revision ### after the copyright. If you want to remove the revision in the title bar you can do
html_theme_options = {
'display_version': False}
You can also have some fun with creating a _templates directory, look at the layout.html and create a file called _templates/layout.html with your modification. This is not too complex if you have some developement skills. Have a look at the "template" section of sphinx or jinja. For instance the following file add hello world in the side bar, and then "index" in the menu
I had already tried html_show_sourcelink = False and it does remove the view page source message when using make html locally on my machine. However, it doesn't do anything about the Edit on Github display when using readthedocs.org.
The suggestion of using the details below works great when using Sphinx only, but once again, not on readthedocs.org.
html_theme_options = { 'display_version': False}
readthedocs github suggested the _templates tweaks you've noted above, however, I don't have the experience necessary and am feeling lost.
Thanks for your help thus far, anything else you can do would be greatly appreciated.
@escribis This is the template I'm using, are you saying I'd copy the source of it, remove the "edit on github" option, which I'm not even sure where it is based on a quick read of it, add this to my local repo and push for RTD to re-build it?
@escribis actually, found it in breadcrumbs.html, but using display_github with False doesn't seem to make it work, so please try and explain what all I would need to modify in breadcrumbs.html to get this working.
I found myself in your situation where I wanted to remove certain elements from the page. I ended up doing them via javascript. You know if you include
And if you want to only hide these links on some pages (e.g. on pages generated by autosummary which don't have corresponding github file anyway) then you can use that technique in combination with file-level metadata:
In breadcrumbs.html:
{%- extends "sphinx_rtd_theme/breadcrumbs.html" %}
{% block breadcrumbs_aside %}
{% if not meta or meta.get('github_url') != 'hide' %}
{{ super() }}
{% endif %}
{% endblock %}
On the page which should not have github link, add to the very beginning:
Activity
shimizukawa commentedon Mar 19, 2016
Sorry, I donkt know how to disable it because the feature is provided by readthedocs building system. So, please contact to https://github.com/rtfd/readthedocs.org or https://github.com/snide/sphinx_rtd_theme.
xcriptus commentedon Mar 19, 2016
Hi,
you should try to put the following line in your conf.py file
I've no revision ### after the copyright. If you want to remove the revision in the title bar you can do
You can also have some fun with creating a
_templatesdirectory, look at the layout.html and create a file called_templates/layout.htmlwith your modification. This is not too complex if you have some developement skills. Have a look at the "template" section of sphinx or jinja. For instance the following file add hello world in the side bar, and then "index" in the menuHope this helps.
Jean-marie
brianjking commentedon Mar 20, 2016
@escribis
I had already tried
html_show_sourcelink = Falseand it does remove theview page sourcemessage when usingmake htmllocally on my machine. However, it doesn't do anything about theEdit on Githubdisplay when using readthedocs.org.The suggestion of using the details below works great when using Sphinx only, but once again, not on readthedocs.org.
html_theme_options = { 'display_version': False}readthedocs github suggested the _templates tweaks you've noted above, however, I don't have the experience necessary and am feeling lost.
Thanks for your help thus far, anything else you can do would be greatly appreciated.
Thanks & Cheers!
brianjking commentedon Mar 20, 2016
@escribis This is the template I'm using, are you saying I'd copy the source of it, remove the "edit on github" option, which I'm not even sure where it is based on a quick read of it, add this to my local repo and push for RTD to re-build it?
https://github.com/snide/sphinx_rtd_theme/blob/master/sphinx_rtd_theme/layout.html
Thanks!
(If I had to guess the line I'd remove it would be this https://github.com/snide/sphinx_rtd_theme/blob/master/sphinx_rtd_theme/layout.html#L147)
brianjking commentedon Mar 20, 2016
@escribis actually, found it in breadcrumbs.html, but using
display_githubwith False doesn't seem to make it work, so please try and explain what all I would need to modify inbreadcrumbs.htmlto get this working.Thank you so much!
https://github.com/snide/sphinx_rtd_theme/blob/master/sphinx_rtd_theme/breadcrumbs.html#L16-L19
JimiC commentedon Apr 6, 2016
I found myself in your situation where I wanted to remove certain elements from the page. I ended up doing them via javascript. You know if you include
in
conf.pyand have the corresponding folders under_static, you can style your pages and execute js on them.brianjking commentedon May 9, 2016
Okay, I figured out the "Edit on Github" portion a while ago and thought I'd share my fixes here for anyone else looking to accomplish this.
I've also documented this on my StackOverflow question.
Assuming you're using the ReadTheDocs default theme this should work just fine.
breadcrumbs.htmlfile (https://github.com/snide/sphinx_rtd_theme/blob/master/sphinx_rtd_theme/breadcrumbs.html)breadcrumbs.htmlfile to your Sphinx documentation folder in the_templates folder.If this directory doesn't yet exist you'll need to create it.conf.pyfile locate yourhtml_contextsection, if you do not already have this, you can create it. (Sample linked below).breadcrumbs.htmlfile to your tracked files using Gitconf.pyReferences
benjaoming commentedon Dec 7, 2017
This doesn't work right now because setting
html_contextinconf.pyis broken. See: #2442MarSoft commentedon Apr 1, 2019
Just for record, the right way is now documented here: https://docs.readthedocs.io/en/stable/guides/remove-edit-buttons.html
And if you want to only hide these links on some pages (e.g. on pages generated by
autosummarywhich don't have corresponding github file anyway) then you can use that technique in combination with file-level metadata:In
breadcrumbs.html:On the page which should not have github link, add to the very beginning:
Remove "Edit on Github" link: sphinx-doc/sphinx#2386
Remove "Edit on Github" link: sphinx-doc/sphinx#2386
Remove "Edit on Github" link: sphinx-doc/sphinx#2386
Remove "Edit on Github" link: sphinx-doc/sphinx#2386
Remove "Edit on Github" link: sphinx-doc/sphinx#2386
Remove "Edit on Github" link: sphinx-doc/sphinx#2386
Remove "Edit on Github" link: sphinx-doc/sphinx#2386