Skip to content

Commit

Permalink
Use searchfield instead of searchbox component in sidebar
Browse files Browse the repository at this point in the history
This moves the search field up before the navigation. It's quite
commmon that search is near the top of the page. Also, this
results in a fixed position, because navigation is page dependent
and may be long, which could move the search field far down or
even off-page in the old layout.

The searchfield component
(sphinx-doc/sphinx#11045)
is more compact and does not have a heading, which reduces
clutter and gives more focus to the content sections.
  • Loading branch information
timhoffm committed Jul 8, 2024
1 parent ea9e92b commit 0995ab5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions alabaster/static/alabaster.css_t
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,17 @@ div.sphinxsidebar ul li.toctree-l2 > a {
font-size: 110%;
}


div.sphinxsidebar input {
border: 1px solid {{ theme_sidebar_search_button }};
font-family: {{ theme_font_family }};
font-size: 1em;
}

div.sphinxsidebar #searchbox {
margin: 1em 0;
}

div.sphinxsidebar #searchbox input[type="text"] {
width: 160px;
}
Expand Down
2 changes: 1 addition & 1 deletion alabaster/theme.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[theme]
inherit = basic
stylesheet = alabaster.css
sidebars = about.html, navigation.html, relations.html, searchbox.html, donate.html
sidebars = about.html, searchfield.html, navigation.html, relations.html, donate.html
pygments_style = alabaster.support.Alabaster

[options]
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
html_sidebars = {
"**": [
"about.html",
"searchfield.html",
"navigation.html",
"relations.html",
"searchbox.html",
"donate.html",
]
}
Expand Down

0 comments on commit 0995ab5

Please sign in to comment.