Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Sphinx theme option "prev_next_buttons_location" does not work #903

Closed
gthvidsten opened this issue Apr 22, 2020 · 13 comments
Closed

Sphinx theme option "prev_next_buttons_location" does not work #903

gthvidsten opened this issue Apr 22, 2020 · 13 comments
Labels
Support Support question

Comments

@gthvidsten
Copy link

Details

Expected Result

html_theme_options in conf.py should be applied

Actual Result

I added html_theme_options to my conf.py file as per the instruction for the RTD sphinx theme: https://sphinx-rtd-theme.readthedocs.io/en/stable/configuring.html

html_theme_options = {
    'collapse_navigation': False,
    'prev_next_buttons_location': 'None'
}

This has no effect. I haven't come far enough in the documentation that I have enough levels to test the first option yet, but the second option, prev_next_buttons_location, should have removed the Next/Previous buttons from the generated documentation. These buttons are still there when the documentation is built.

@stsewd stsewd transferred this issue from readthedocs/readthedocs.org Apr 22, 2020
@mondeja
Copy link
Contributor

mondeja commented Apr 26, 2020

I can't reproduce this issue with Sphinx 1.8.5 and sphinx_rtd_theme 0.4.3. Have you added the line html_theme = "sphinx_rtd_theme" to your conf.py file?

@gthvidsten
Copy link
Author

No, I haven't. I thought that was the default theme that didn't need to be inlucded.
Am I supposed to use that line even though it is the default to get html_theme_options to work?

@mondeja
Copy link
Contributor

mondeja commented Apr 26, 2020

No, I haven't. I thought that was the default theme that didn't need to be inlucded.
Am I supposed to use that line even though it is the default to get html_theme_options to work?

Yes, you need to include it because the default theme for sphinx is alabaster.

@gthvidsten
Copy link
Author

This is on ReadTheDocs, so I automatically get the RTD sphinx theme without specifying a theme.

@mondeja
Copy link
Contributor

mondeja commented Apr 26, 2020

The default value of html_theme if you don't set it explicitly is "alabaster" as you can see here. Seems that, even if you are building in ReadTheDocs, you need to set it explicitly to make html_theme_options to understand the configuration field prev_next_buttons_location. You can use this to make it work in ReadTheDocs:

html_theme = "alabaster"
if "READTHEDOCS" in os.environ:
    html_theme = "sphinx_rtd_theme"

@gthvidsten
Copy link
Author

gthvidsten commented Apr 26, 2020

I've started a new build at ReadTheDocs with html_theme. Hopefully this is enough :)

I still think it shouldn't be necessary to have to specify html_theme for html_theme_options, though, to make life just a little bit easier for users.

EDIT:

And now that the RTD build finally completed, I can see that the next/previous buttons are still there, even though I now have this in my conf.py:

html_theme: 'sphinx_rtd_theme'
html_theme_options = {
    'collapse_navigation': False,
    'prev_next_buttons_location': 'None'
}

@mondeja
Copy link
Contributor

mondeja commented Apr 26, 2020

It seems that is an error with readthedocs.org builds, because I can't reproduce it in local.

@gthvidsten
Copy link
Author

I suspected as much, which is why I posted it in their issue list originally (but it got moved here). If someone can move it back it would be greatly appreciated :)

@stsewd
Copy link
Member

stsewd commented Apr 27, 2020

@gthvidsten make sure you are using the same sphinx version locally and on rtd https://docs.readthedocs.io/en/stable/guides/specifying-dependencies.html

@gthvidsten
Copy link
Author

I'm not doing any local documentation. I use readthedocs exclusively.

@stsewd
Copy link
Member

stsewd commented Apr 27, 2020

@gthvidsten
Copy link
Author

I'm not looking to run Sphinx locally. I just want to use the one on RTD... and that doesn't use any of the html_theme_options whether or not html_theme is set, and me running Sphinx locally will not change the RTD behavior.

@stsewd
Copy link
Member

stsewd commented Oct 7, 2020

@gthvidsten looks like you have typo in https://github.com/whitestone-no/Cambion/blob/9c90ff07978b25b873bae781df69c1af1b716c59/docs/conf.py#L15

it should be html_theme = 'sphinx_rtd_theme'

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Support Support question
Projects
None yet
Development

No branches or pull requests

3 participants