-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ NEW: hide sidebar + navbar_align options #263
Conversation
4569960
to
c4c863f
Compare
c4c863f
to
809812a
Compare
Can I please get some comments on this? Maybe either @hoetmaaiers or @jorisvandenbossche ? I just rebased and lost like 30 minutes trying to figure out how to re-build webpack and not generate more conflicts, so I would really like to either close this if people don't want it, or make modifications and get it merged so that I don't have to keep dealing with conflicts... If folks are unhappy with the topbar behavior change, I can make it configurable for the user, but IMO it looks weirder to have the topbar mis-aligned from the text and in the middle if there is no sidebar, vs. just having the topbar items snap to the left all the time (note, there are really only a few files changed here, the 66 files changed are because a bunch of packages updated when I ran the pre-commit) |
pydata_sphinx_theme/docs-navbar.html
Outdated
@@ -12,7 +12,7 @@ | |||
<span class="navbar-toggler-icon"></span> | |||
</button> | |||
|
|||
<div id="navbar-menu" class="col-lg-9 collapse navbar-collapse"> | |||
<div id="navbar-menu" class="col-11 collapse navbar-collapse"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here we make the topbar items position to the left, instead of being centered in the middle of the topbar
pydata_sphinx_theme/layout.html
Outdated
@@ -61,7 +66,7 @@ | |||
{% endblock %} | |||
|
|||
{% block docs_main %} | |||
<main class="col-12 col-md-9 col-xl-7 py-md-5 pl-md-5 pr-md-4 bd-content" role="main"> | |||
<main class="col py-md-5 pl-md-5 pr-md-4 bd-content" role="main"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setting the main content to just col
as I believe this will make it grow to fill up available space around it, rather than explicitly defining its size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that this change is causing the problem on https://pydata-sphinx-theme--263.org.readthedocs.build/en/263/demo/demo.html
I suppose there is some content on that page that is larger, and causes the main text column to be wider if it is not constrained to a max size, and then causing the right toc sidebar to have no space anymore to appear on the side
@choldgraf taking a look now (and thanks for working on this!) Hmm, if the dev setup with webpack keeps giving you headaches, we need to reconsider it (I don't fully understand what went wrong in this case, for me it mostly works smoothly, but it seems you updated the versions of the vendored assets (fonts, fontawesome)). Generally it looks like a nice and clean solution to have the "no-sidebar" option. I am not yet fully convinced about the alignment of the links in the navbar, so if we could leave that for a separate PR that might be good (or configurable? although that might be hard). Will try to give some more input about that on the issue. Looking at the preview docs, I notice a few issues:
Do you know if it would be possible in sphinx to update this html_sidebars config when processing a given page based on such a |
I suppose that if we want a |
@jorisvandenbossche thanks for the review! A couple responses:
good catch, I think this is actually related to using
Lemme see how much work it'd be to make it configurable. It may not be too bad. Something like
Since that issue is not related to this PR and is more about the pydata theme docs themselves, how about I just move the search bar back to its normal position, and then I'll choose a page deeper in the docs where we can demo the "no sidebars" option rather than having it be the landing page. When we fix #258 then we can move the docs search bar to the navbar if we wish.
I will play around with this and try to get it to a nicer-looking default.
Yeah this was my feeling too. How about we start off with just using |
Certainly! |
ceba2a8
to
c475f4f
Compare
@jorisvandenbossche take a look at the latest push and see if that fixes things up. I believe that I addressed the comments that you gave. This is the new page w/ no sidebar: https://pydata-sphinx-theme--263.org.readthedocs.build/en/263/changelog.html And just to confirm, this page now works: https://pydata-sphinx-theme--263.org.readthedocs.build/en/263/demo/demo.html |
2854159
to
682784f
Compare
682784f
to
c09fbfd
Compare
OK @jorisvandenbossche - I've applied the patch you recommended and it worked! Also had to rebase to avoid a merge conflict with the hashes. I think this is ready to go if you're 👍 on the changes. |
I take it back! Need to figure out one bug on the sidebar width |
OK fixed - now it's ready for review and/or merge. You can demo here: https://pydata-sphinx-theme--263.org.readthedocs.build/en/263/changelog.html (sorry for the noise @jorisvandenbossche ) |
@mwaskom it is how you configure the sidebars for any pages, including choosing particular components for the sidebar on subsets of pages, or removing it entirely in some cases.
so if you do:
then the default sidebar components will show up on all pages except |
@choldgraf thanks for the updates! Playing around a bit with the demo docs looks good now
The options looks fine. I am only thinking about the type of value, which is now a boolean, and thus only leaves two options. Maybe something like |
Hmmm - I don't have strong opinions on bool vs. left/content...I'd be happy to go with that if you think it's better |
Other then the suggestion to rework navbar_alignment to a string for extensibility, I have no other remarks. |
b088693
to
9409824
Compare
OK so taking the feedback of @jorisvandenbossche and @hoetmaaiers , the config is now called Here's what |
Seemed pretty easy to get working, and did what I expected it to. The seaborn docs have some other aspects that render poorly with (at least the default config of) the pydata theme, but this one was a big hurdle. 👍 |
@mwaskom I'm curious what are the other places where the pydata theme doesn't work properly! (maybe in a different issue?) |
Sure, but I feel like I should put in at least a minimum amount of effort to figure out whether it’s just a config setting that I can change :) Seaborn docs also do a lot of bespoke html fiddling on top of the current Sphinx theme, and not at all in a principled or well-implemented way, so... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update!
@mwaskom any additional feedback / feature requests to get it working as you want with seaborn is very welcome! |
wohoo! 🎉 |
@choldgraf There seems to be a minor typo in the configuration documentation:
should read:
occurs 3x ie. this config key is shown incorrectly for each of the three values. (Apologies if this comment is in the wrong place but this has not been officialy released yet therefore I did not want to raise an issue.) |
ah yes I believe you are right @CodeCox ! Wanna make a docs PR to change it? I'm happy to review |
@choldgraf Yes, I'm happy to give it a shot in the next few days! It's a trivial change but I need to figure out the PR process for this repository. It will be good preporatory learning for me. (The code for this PR has not yet been officially released but the related doc is already live - so there is already a disjoint because of this disparity!) |
I don't think here's a giant problem, but we should definitely fix soonish. No hurries and I am happy to help if you hit issues 👍 |
This adds support for hiding sidebars on some page using
html_sidebars
. It does a few things to make this work:html_sidebars
, check for whether any sidebar items exist on a page, and if not, it shrinks and hides the sidebar.👆 That last one in particular may be worth discussing, but IMO it is a more robust solution than trying to make the navbar links line up with the page content. The reason I did this is because unless we keep the navbar items snapped to the left (or right) side of the page, any change in content width is going to be jarring for the user since they'll expect them to line up
And for our docs:
Would love feedback on whether people think this is a good solution
New home page w/o sidebar on
index
:Old home page with sidebar on
index
:Partially addresses #262 #146
another option here would be to use a specific config like
nosidebar
for certain pages, rather than inferring it from thehtml_sidebars
config (as @mwaskom suggested)...I'd be fine with that approach too but wanted to get this up here to look at