Skip to content

HIde Section NAV if empty#224

Closed
sekyondaMeta wants to merge 0 commit intopytorch:pytorch_sphinx_theme2from
sekyondaMeta:pytorch_sphinx_theme2
Closed

HIde Section NAV if empty#224
sekyondaMeta wants to merge 0 commit intopytorch:pytorch_sphinx_theme2from
sekyondaMeta:pytorch_sphinx_theme2

Conversation

@sekyondaMeta
Copy link

If page has no toctree, hide the Section Nav

@netlify
Copy link

netlify bot commented Jan 30, 2026

Deploy Preview for pytorchsphinxtheme ready!

Name Link
🔨 Latest commit b16339b
🔍 Latest deploy log https://app.netlify.com/projects/pytorchsphinxtheme/deploys/69839311f04e7d000813e585
😎 Deploy Preview https://deploy-preview-224--pytorchsphinxtheme.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@meta-cla meta-cla bot added the cla signed label Jan 30, 2026
{% block docs_sidebar %}
{% set sidebar_items = sidebars or theme_primary_sidebar_items %}
{% if theme_navbar_center or theme_navbar_end or sidebar_items or theme_primary_sidebar_end %}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking, we might be able to achieve this with .css only:

.bd-sidebar-primary:not(:has(.bd-docs-nav li)) {
  display: none !important;
}

@media (min-width: 960px) {
  .bd-sidebar-primary:not(:has(.bd-docs-nav li)) + .bd-main .bd-content .bd-article-container {
    padding-left: 8rem !important;
  }
}

{{ super() }}
{% endblock %}

{# PR #215: Conditional sidebar rendering - hide sidebar when no toctree content #}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to undo all the changes to the templates

padding: 1em;
margin-bottom: 1em;
border-bottom: 2px solid black;
content: "Error: Can't find stylesheet to import.\a \2577 \a 19 \2502 @use \"@fortawesome/fontawesome-free/scss/fontawesome\";\a \2502 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\a \2575 \a pytorch_sphinx_theme2/static/scss/main.scss 19:1 root stylesheet";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something got broken here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably just undo all the changes to the theme.css and have only laout.scss updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants