godot-docs
godot-docs copied to clipboard
Make sidebar categories collapsible
An alternative for https://github.com/godotengine/godot-docs/pull/5948. I like it more.
https://user-images.githubusercontent.com/11782833/179815915-9366498c-cabd-43f9-af9d-6c049664a3c1.mp4
Is the current category always un-collpased? I.e. if I'm landing on a page from Google? Likewise, maybe the first category should be expanded by default when on the start page?
Is the current category always un-collpased? I.e. if I'm landing on a page from Google?
Yes, the category that the page belongs to is expanded by default.
Likewise, maybe the first category should be expanded by default when on the start page?
Well, sure, I don't mind but it also doesn't really matter IMO.
It does look a bit idle and not clear that you can interact with the titles on the main landing page, that is true. But as several people suggested on Twitter, I should probably add an arrow/chevron/plus character to indicate that they are expandable.
It does look a bit idle and not clear that you can interact with the titles on the main landing page, that is true. But as several people suggested on Twitter, I should probably add an arrow/chevron/plus character to indicate that they are expandable.
I agree with that, besides that this does look cleaner IMO :)
Added an arrow to better indicate that sections can be toggled. The video in the OP is updated.
Some people on Twitter complain that auto-hiding other sections when you open another one is not something they'd enjoy. Opinions? I think it's okay to auto-hide, as it keeps the list focused and you don't really need to work with multiple sections at the same time. You need to get to the article you want as fast as possible.
Some people on Twitter complain that auto-hiding other sections when you open another one is not something they'd enjoy. Opinions? I think it's okay to auto-hide, as it keeps the list focused and you don't really need to work with multiple sections at the same time. You need to get to the article you want as fast as possible.
I'm neutral about this. I much prefer accordion setups that don't automatically fold other sections when you unfold one of them, but our setup involves a really long list. So I think this behavior makes sense here.
I think we can merge this for now. We can change the behavior to not automatically fold other sections if there's significant demand.
I'd also like Akien to give this a glance, but I agree with both of you and think this is a good improvement.
Updated based on suggestions.
- "General" is now collapsed into "About" (the dedicated "About" page still exists for those who may have stored a direct link to it).
- "Development" is now "Engine Development". This does collide with its own subsection, though. Can clean it up later, I suppose, as this doesn't affect any links (the link for that subsection is "development/cpp").
- On the home page the "About" section is unfolded by default. This also acts as a nice hint that you can unfold other sections to see their content.
I've not touched the class reference section, as we already have a different PR that would split those classes into several categories, and that solves the ambiguous "Godot API" problem.

Edit: I'll remove the 3.5 cherrypick for the time being. We need to see what the feedback would be on this one anyway, and later we can pick it or port it by hand.
Thanks!
After this change, it was necessary for me to update Sphinx. Sphinx 4.0.2 didn't have the required functionality and I couldn't open the categories after compiling locally.
A pip3 install -r requirements.txt did the trick.
This is a purely frontend solution, it shouldn't depend on anything from sphinx, other than the layout of the page. So yeah, a good idea to verify that your local install matches the requirements.