Skip to content

Commit 457b3fd

Browse files
12rambaudrammock
authored andcommitted
fix: allow user to control the back-to-top button presence (pydata#1616)
* fix: put the btt button closer to age bottom * test: remove the btt button to check * test: fallback to default behaviour * refactor: rollback to previous state * use proper variable name * Update src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html --------- Co-authored-by: Daniel McCloy <[email protected]>
1 parent 0ecbee2 commit 457b3fd

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

docs/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@
189189
"version_match": version_match,
190190
},
191191
"navigation_with_keys": False,
192+
# "back_to_top_button": False,
192193
# "search_bar_position": "navbar", # TODO: Deprecated - remove in future version
193194
}
194195

src/pydata_sphinx_theme/assets/styles/base/_base.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ pre {
172172
z-index: $zindex-tooltip;
173173
position: fixed;
174174
display: none;
175-
top: 80vh;
175+
top: 90vh;
176176
left: 50vw;
177177
transform: translate(-50%);
178178
color: var(--pst-color-secondary-text);

src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html

+2
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@
4343
{# A tiny helper pixel to detect if we've scrolled #}
4444
<div id="pst-scroll-pixel-helper"></div>
4545

46+
{%- if theme_back_to_top_button %}
4647
{# the scroll to top button #}
4748
<button type="button" class="btn rounded-pill" id="pst-back-to-top">
4849
<i class="fa-solid fa-arrow-up"></i>
4950
{{ _("Back to top") }}
5051
</button>
52+
{%- endif %}
5153

5254
{# checkbox to toggle primary sidebar #}
5355
<input type="checkbox"

src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ pygment_light_style = a11y-high-contrast-light
3737
pygment_dark_style = a11y-high-contrast-dark
3838
logo =
3939
surface_warnings = True
40+
back_to_top_button = True
4041

4142
# Template placement in theme layouts
4243
navbar_start = navbar-logo

0 commit comments

Comments
 (0)