File tree 11 files changed +66
-44
lines changed 11 files changed +66
-44
lines changed Original file line number Diff line number Diff line change
1
+ < div class ="sidebar-message ">
2
+ This is a community-supported theme.
3
+ If you'd like to contribute,
4
+ < a href ="https://github.com/pandas-dev/pydata-sphinx-theme "> check out our GitHub repository</ a >
5
+ Your contributions are welcome!
6
+ </ div >
Original file line number Diff line number Diff line change 49
49
# This pattern also affects html_static_path and html_extra_path.
50
50
exclude_patterns = ["_build" , "Thumbs.db" , ".DS_Store" ]
51
51
52
+ html_sidebars = {
53
+ "contributing" : ["sidebar-search-bs.html" , "custom-template.html" ],
54
+ }
52
55
53
56
# -- Options for HTML output -------------------------------------------------
54
57
Original file line number Diff line number Diff line change @@ -48,6 +48,17 @@ an external site. You can add external links to the nav bar like so:
48
48
]
49
49
}
50
50
51
+ Configure the sidebar
52
+ =====================
53
+
54
+ ``pydata_sphinx_theme `` provides two new sidebar items by default:
55
+
56
+ - ``sidebar-nav-bs.html `` - a bootstrap-friendly navigation section
57
+ - ``sidebar-search-bs.html `` - a bootstrap-friendly search bar
58
+
59
+ By default, this theme's sidebar has these two elements in it. If you'd like to
60
+ override this behavior and control the sidebar on a per-page basis, use the
61
+ `Sphinx html-sidebars configuration value <https://www.sphinx-doc.org/en/master/usage/configuration.html?highlight=html_sidebars#confval-html_sidebars >`_.
51
62
52
63
Hiding the previous and next buttons
53
64
====================================
Original file line number Diff line number Diff line change @@ -199,4 +199,9 @@ def setup(app):
199
199
app .connect ("html-page-context" , setup_edit_url )
200
200
app .connect ("html-page-context" , add_toctree_functions )
201
201
202
+ # Update templates for sidebar
203
+ pkgdir = os .path .abspath (os .path .dirname (__file__ ))
204
+ path_templates = os .path .join (pkgdir , "_templates" )
205
+ app .config .templates_path .append (path_templates )
206
+
202
207
return {"parallel_read_safe" : True , "parallel_write_safe" : True }
Original file line number Diff line number Diff line change
1
+ < nav class ="bd-links " id ="bd-docs-nav " aria-label ="Main navigation ">
2
+
3
+ < div class ="bd-toc-item active ">
4
+ {% set nav = get_nav_object(maxdepth=3, collapse=True) %}
5
+
6
+ < ul class ="nav bd-sidenav ">
7
+ {% for main_nav_item in nav %}
8
+ {% if main_nav_item.active %}
9
+ {% for nav_item in main_nav_item.children %}
10
+ {% if nav_item.children %}
11
+
12
+ < li class ="{% if nav_item.active%}active{% endif %} ">
13
+ < a href ="{{ nav_item.url }} "> {{ nav_item.title }}</ a >
14
+ < ul >
15
+ {% for nav_item in nav_item.children %}
16
+ < li class ="{% if nav_item.active%}active{% endif %} ">
17
+ < a href ="{{ nav_item.url }} "> {{ nav_item.title }}</ a >
18
+ </ li >
19
+ {% endfor %}
20
+ </ ul >
21
+ </ li >
22
+ {% else %}
23
+ < li class ="{% if nav_item.active%}active{% endif %} ">
24
+ < a href ="{{ nav_item.url }} "> {{ nav_item.title }}</ a >
25
+ </ li >
26
+ {% endif %}
27
+ {% endfor %}
28
+ {% endif %}
29
+ {% endfor %}
30
+ </ ul >
31
+
32
+ </ nav >
Original file line number Diff line number Diff line change
1
+ {% if theme_search_bar_position == "sidebar" %}
2
+ {%- include "search-field.html" %}
3
+ {% endif %}
Original file line number Diff line number Diff line change 1
-
2
-
3
- {% if theme_search_bar_position == "sidebar" %}
4
- {%- include "search-field.html" %}
5
- {% endif %}
6
-
7
- < nav class ="bd-links " id ="bd-docs-nav " aria-label ="Main navigation ">
8
-
9
- < div class ="bd-toc-item active ">
10
- {% set nav = get_nav_object(maxdepth=3, collapse=True) %}
11
-
12
- < ul class ="nav bd-sidenav ">
13
- {% for main_nav_item in nav %}
14
- {% if main_nav_item.active %}
15
- {% for nav_item in main_nav_item.children %}
16
- {% if nav_item.children %}
17
-
18
- < li class ="{% if nav_item.active%}active{% endif %} ">
19
- < a href ="{{ nav_item.url }} "> {{ nav_item.title }}</ a >
20
- < ul >
21
- {% for nav_item in nav_item.children %}
22
- < li class ="{% if nav_item.active%}active{% endif %} ">
23
- < a href ="{{ nav_item.url }} "> {{ nav_item.title }}</ a >
24
- </ li >
25
- {% endfor %}
26
- </ ul >
27
- </ li >
28
- {% else %}
29
- < li class ="{% if nav_item.active%}active{% endif %} ">
30
- < a href ="{{ nav_item.url }} "> {{ nav_item.title }}</ a >
31
- </ li >
32
- {% endif %}
33
- {% endfor %}
34
- {% endif %}
35
- {% endfor %}
36
- </ ul >
37
-
38
- </ nav >
Original file line number Diff line number Diff line change 46
46
< div class ="row ">
47
47
{% block docs_sidebar %}
48
48
< div class ="col-12 col-md-3 bd-sidebar ">
49
- {%- include "docs-sidebar.html" %}
49
+ {%- for sidebartemplate in sidebars %}
50
+ {%- include sidebartemplate %}
51
+ {%- endfor %}
50
52
</ div >
51
53
{% endblock %}
52
54
Original file line number Diff line number Diff line change 1
1
[theme]
2
2
inherit = basic
3
3
pygments_style = tango
4
+ sidebars = sidebar-search-bs.html, sidebar-nav-bs.html
4
5
5
6
[options]
6
7
sidebarwidth = 270
Original file line number Diff line number Diff line change 18
18
19
19
# Base options, we can add other key/vals later
20
20
html_theme_options = {}
21
+
22
+ html_sidebars = {"section1/index" : ["sidebar-nav-bs.html" ]}
Original file line number Diff line number Diff line change 1
1
< div class ="col-12 col-md-3 bd-sidebar ">
2
- < form action ="../search.html " class ="bd-search d-flex align-items-center " method ="get ">
3
- < i class ="icon fas fa-search ">
4
- </ i >
5
- < input aria-label ="Search the docs ... " autocomplete ="off " class ="form-control " id ="search-input " name ="q " placeholder ="Search the docs ... " type ="search "/>
6
- </ form >
7
2
< nav aria-label ="Main navigation " class ="bd-links " id ="bd-docs-nav ">
8
3
< div class ="bd-toc-item active ">
9
4
< ul class ="nav bd-sidenav ">
You can’t perform that action at this time.
0 commit comments