mgeier / insipid-sphinx-theme

:yawning_face: An insipid theme for the Sphinx documentation generator.
https://insipid-sphinx-theme.readthedocs.io/
BSD 2-Clause "Simplified" License
38 stars 4 forks source link

Differentiate between top and bottom prev/next buttons #148

Closed hagenw closed 1 year ago

hagenw commented 1 year ago

If a documentation contains a lot of short pages it looks a little bit weird that we have prev/next buttons at the top and the bottom, e.g.

image

One solution might be to automatically adjust if we present the buttons at the top depending on the page length.

An easier solution would be to provide different CSS classes for them so a user could write custom CSS code to hide one occurrences of the next/prev buttons. At the moment this is not possible as they are both added to the page with the relbar class. Maybe one could add an additional top and bottom class to them, e.g.

<nav class="relbar top">
mgeier commented 1 year ago

The "relbars" can already be activated and deactivated individually using the relbar1 and relbar2 blocks, as shown in https://insipid-sphinx-theme.readthedocs.io/en/0.4.1/customization.html#custom-templates

This affects all pages, but you might be able to get per-page settings with some additional Jinja2 magic?

hagenw commented 1 year ago

Thanks, I overlooked this. It is indeed straightforward, the _templates/layout.html file just needs to contain:

{% extends "!layout.html" %}

{% block relbar1 %}{% endblock %}

to disable the top next /prev buttons.

mgeier commented 1 year ago

Indeed, the breadcrumbs branch is an example for that: https://github.com/mgeier/insipid-sphinx-theme/compare/breadcrumbs^...breadcrumbs.

hagenw commented 1 year ago

The current solution seems fine to me. You can close this issue if you like as I don't think it is necessary to provide the functionality of automatically adjusting the visibility of the top and/or bottom prev/next buttons.