Skip to content

Commit 0d7addb

Browse files
committed
align_with_content
1 parent c475f4f commit 0d7addb

File tree

5 files changed

+7
-13
lines changed

5 files changed

+7
-13
lines changed

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"twitter_url": "https://twitter.com/pandas_dev",
7171
"use_edit_page_button": True,
7272
"show_toc_level": 1,
73-
# "navbar_snap_left": True, # For testing that the navbar items snap to left properly
73+
"navbar_align_with_content": True, # For testing that the navbar items snap to left properly
7474
}
7575

7676
html_context = {

docs/user_guide/configuring.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,14 @@ For information about configuring the sidebar's contents, see :ref:`configure-si
219219
Make navbar menu items snap to the left
220220
=======================================
221221

222-
By default, the navigation bar menu items will begin in-line with the content on your
222+
By default, the navigation bar menu items will align with the content on your
223223
page. If instead you'd like these items to snap to the left (closer to the logo), then
224224
use the following configuration:
225225

226226
.. code-block:: python
227227
228228
html_theme_options = {
229229
...
230-
"navbar_snap_left": True
230+
"navbar_align_with_content": False
231231
...
232232
}

pydata_sphinx_theme/docs-navbar.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@
1111
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-menu" aria-controls="navbar-menu" aria-expanded="false" aria-label="Toggle navigation">
1212
<span class="navbar-toggler-icon"></span>
1313
</button>
14-
15-
{% if theme_navbar_snap_left in [True, "True"] %}
16-
{% set navbar_col_class = "col-11" %}
17-
{% else %}
18-
{% set navbar_col_class = "col-lg-9" %}
19-
{% endif %}
20-
<div id="navbar-menu" class="{{ navbar_col_class }} collapse navbar-collapse">
14+
<div id="navbar-menu" class="{% if theme_navbar_align_with_content in [True, 'True'] %}col-lg-9 {% endif %}collapse navbar-collapse">
2115
<ul id="navbar-main-elements" class="navbar-nav mr-auto">
2216
{% set nav = get_nav_object(maxdepth=1, collapse=True) %}
2317
{% for main_nav_item in nav %}

pydata_sphinx_theme/theme.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ search_bar_text = Search the docs ...
1616
search_bar_position = sidebar
1717
navigation_with_keys = True
1818
show_toc_level = 1
19-
navbar_snap_left = False
19+
navbar_align_with_content = True

tests/test_build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ def test_sidebar_visible(sphinx_build):
113113
sphinx_build.clean()
114114

115115

116-
def test_navbar_snap_left(sphinx_build):
116+
def test_navbar_align_with_content(sphinx_build):
117117
"""The sidebar is shrunk when no sidebars specified in html_sidebars."""
118118
sphinx_build.copy()
119119

120120
sphinx_build.build()
121121
index_html = sphinx_build.get("index.html")
122122
assert "col-lg-9" in index_html.select("div#navbar-menu")[0].attrs["class"]
123123

124-
sphinx_build.build(["-D", "html_theme_options.navbar_snap_left=True"])
124+
sphinx_build.build(["-D", "html_theme_options.navbar_align_with_content=True"])
125125
index_html = sphinx_build.get("index.html")
126126
assert "col-11" in index_html.select("div#navbar-menu")[0].attrs["class"]
127127
sphinx_build.clean()

0 commit comments

Comments
 (0)