Skip to content

Commit 7c7f0ed

Browse files
committed
Add .js to keep left nav expanded
1 parent 5fc25d9 commit 7c7f0ed

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

_static/js/custom.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
document.addEventListener("DOMContentLoaded", function() {
2+
// Select all <li> elements with the class "toctree-l1"
3+
var toctreeItems = document.querySelectorAll('li.toctree-l1');
4+
toctreeItems.forEach(function(item) {
5+
// Check if the item has a nested <ul>
6+
var nestedList = item.querySelector('ul');
7+
if (nestedList) {
8+
// Display the nested list by default
9+
nestedList.style.display = 'block';
10+
}
11+
});
12+
});

conf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def reset_seeds(gallery_conf, fname):
238238
html_logo = '_static/img/pytorch-logo-dark.svg'
239239
html_theme_options = {
240240
'pytorch_project': 'tutorials',
241-
'collapse_navigation': True,
241+
'collapse_navigation': False,
242242
'display_version': True,
243243
'navigation_with_keys': True,
244244
'logo_only': False,
@@ -308,6 +308,10 @@ def reset_seeds(gallery_conf, fname):
308308
'css/custom2.css'
309309
]
310310

311+
html_js_files = [
312+
"js/custom.js",
313+
]
314+
311315
def setup(app):
312316
# NOTE: in Sphinx 1.8+ `html_css_files` is an official configuration value
313317
# and can be moved outside of this function (and the setup(app) function

index.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,6 @@ Additional Resources
915915
See All Prototype Recipes <prototype/prototype_index>
916916

917917
.. toctree::
918-
:maxdepth: 3
919918
:hidden:
920919
:includehidden:
921920
:caption: Introduction to PyTorch
@@ -924,7 +923,7 @@ Additional Resources
924923
beginner/introyt/introyt
925924

926925
.. toctree::
927-
:maxdepth: 2
926+
:maxdepth: 1
928927
:hidden:
929928
:includehidden:
930929
:caption: Learning PyTorch
@@ -968,7 +967,7 @@ Additional Resources
968967
intermediate/forced_alignment_with_torchaudio_tutorial
969968

970969
.. toctree::
971-
:maxdepth: 2
970+
:maxdepth: 1
972971
:includehidden:
973972
:hidden:
974973
:caption: Backends
@@ -987,7 +986,7 @@ Additional Resources
987986
advanced/pendulum
988987

989988
.. toctree::
990-
:maxdepth: 2
989+
:maxdepth: 1
991990
:includehidden:
992991
:hidden:
993992
:caption: Deploying PyTorch Models in Production

0 commit comments

Comments
 (0)