Open hedyhli opened 6 months ago
This is a great idea, and would be really useful for things like the contributing section as you mention.
I do think that the category pages changes would be out of scope for this. It's already a pretty big task, and there are potentially also other things to consider w.r.t category pages, since I think going More->content from the main page to get a jumbled list of things is another issue and could potentially do with a bigger rethink in how individual sub-sections are accessed.
Yes, I think I'll agree that applying this hierarchical layout for category pages will be out of scope for this issue for now. Although it would be great to see at a glance just what pages/guides we have when clicking on the "Content" navbar item, it can be pretty overwhelming and we could just have this issue apply to particular content pages that might benefit from this (or all pages?) such as the contributing guides.
We have some high-quality articles over at
/pages/
and I look forward to seeing more. However, as someone who has a fairly sound grasp of the organization and structure of the content as compared to a new user, I still struggle to navigate and discover more pages with ease. I often find myself stumbling upon pages I have not seen years before (despite themselves being present) as well as having troubles recalling the hierarchies of the content when needing to link a page to someone on the server.I believe it's possible to improve the situation by adding a left column that displays the tree of links representing the hierarchy of content pages - siblings, parents, children (not the headings of the page).
Mock implementation
What we have currently
The breadcrumb at the top of each page lets you jump to one of the parent pages. It's great to know where you are and what else is there higher up the hierarchy, however it doesn't make it easy to directly browse exactly what else is there and visit those pages.
The sub-articles dropdown lets you see the pages under the current page and jump to one of them, but it feels clunky to use and is not very discoverable. Compare this to something like readthedocs themes, Mkdocs themes, the left column is almost impossible to miss, and it easily becomes your main source of discovery for new pages of interest.
Our contributing pages have a lot of sub-pages with valuable information that is very easy to be missed. Some of the sub-pages even have sub-pages of their own. For someone trying to find their way around making contributions to our repositories, it could be daunting to look at the dropdown and not know which page they might need. Each time they finish reading a sub-article they would have to go back to the preview page before attempting to find the right position of the previously visited sub-article, and finally click on the next link. I have experienced this inconvenience personally and I'm sure many new users would go through a similar process.
All this can be improved significantly with the introduction of better navigation component commonly found in documentation websites.
Co-existing with the ToC column
The column for table of contents on the right is great, it's optionally enabled based on the article metadata. Introducing another column on the left of the content alongside the table of contents is still possible.
On screens with a width of a relatively wide laptop or higher
The current reading experience is not super decent. The number of characters in a single line can go up to more than 180! We want to provide good readability for articles that are meant to be read. Adding a navigation column on the left in addition to having the ToC column would not affect these wider viewports at all. In fact, it would improve the readability.
On smaller laptops & tablets
The sidebar can be hidden behind a toggle. When visible, it squishes the main content so that the content is still readable, but might be too narrow for some readers, so for them the sidebar can be hidden by default when reading. There is no need to use a modal for this screen size IMO.
On mobile or vertical screens
The sidebar is visible only after a click on a button, which would display the menu on top of the content. Or in such a way that the normal content is not visible at all. [ReadTheDocs example for mobile]
Modal sidebar example
[π](https://goreleaser.com/customization/env/)https://github.com/python-discord/site/assets/50042066/6fe9ecb9-b1f0-492a-a66e-714d9e01daac
The screencast above illustrates the distinction between toggle of visibility that squishes main content verses one that covers the main content.
And what about category pages?
While the box shadows and title icons for the category listings makes the category pages clear and appealing, it can also benefit from a makeover that makes use of tree-like navigation. Unlike GitHub, we don't have a lot of tabular information like last commit dates to show.
An example of this in action
The categories can be toggled to collapse pages under it, with each category page showing the direct children by default, all other pages are hidden until toggled.
We could also just show the same sidebar as those on normal pages, just like GitHub does for directories.
This can make use of a reusable component defined for the sidebar used on content pages.
One might argue it's out of scope for this issue, so I'll leave this up to discussion and for the one who implements this feature.
The specifics
An ideal implementation might look something like the following (note that these are only ideas and is still up to discussion).
Compute the hierarchy of all content pages on site startup, just once. This data structure should allow for selecting a sub-structure for a specified category or page.
When rendering a page, use something like a dictionary to set the current slug to be "highlighted", or some other form of data to be passed to the template when rendering. (Note that we already know the parents for a page through
PageOrCategoryView.location.parents
)Each page can add a metadata entry to specify the slug of the highest level parent to be shown in the hierarchy.
For example, we might want all pages in PyDis guides to have the highest level being PyDis guides. Contributing pages to use the primary contributing page as the highest (see the mock implementation screenshot at the top, where the highest level is the contributing page).
This is done to remove unnecessary clutter and indentation in the sidebar based on the scope of the page. Although once we have a prototype we might realize there is no such need to limit the highest level at all. (See Appendix)
In the template for each page, render the hierarchy and apply a class to the currently highlighted item for it to be indicated as current page.
Categories shown in the tree will only be dropdowns with their appropriate icons. Articles with sub-articles would also have links in addition to being dropdowns.
Each category page can show the tree starting from the current category. This can be kept for backwards compatibility but we don't need to link to them in the sidebar for article pages.
All top-level dropdowns will be unexpanded by default except the one that leads to the current page. Unless this is too hard to implement we can expand all for the initial implementation and improve it in the future. (See Appendix)
More examples
Consider these only for inspiration:
Appendix
These are only for reference to gauge the approximate length and maximum indent level for a tree.
A fully expanded tree for all content pages
``` . βββ _info.yml βββ code-of-conduct.md βββ frequently-asked-questions.md βββ guides β βββ _info.yml β βββ pydis-guides β β βββ _info.yml β β βββ asking-good-questions.md β β βββ code-reviews-primer.md β β βββ contributing β β β βββ _info.yml β β β βββ bot-extended-configuration-options.md β β β βββ bot.md β β β βββ cloning-repository.md β β β βββ commit-messages.md β β β βββ configure-environment-variables.md β β β βββ contributing-guidelines.md β β β βββ creating-bot-account.md β β β βββ docker.md β β β βββ forking-repository.md β β β βββ hosts-file.md β β β βββ installing-project-dependencies.md β β β βββ issues.md β β β βββ linting.md β β β βββ logging.md β β β βββ obtaining-discord-ids.md β β β βββ pull-requests.md β β β βββ setting-test-server-and-bot-account.md β β β βββ sir-lancebot β β β β βββ _info.yml β β β β βββ env-var-reference.md β β β βββ sir-lancebot.md β β β βββ site.md β β β βββ style-guide.md β β β βββ working-with-git β β β β βββ _info.yml β β β β βββ cli.md β β β β βββ pycharm.md β β β βββ working-with-git.md β β βββ contributing.md β β βββ help-channel-guide.md β β βββ helping-others.md β β βββ how-to-contribute-a-page.md β β βββ off-topic-etiquette.md β βββ python-guides β βββ _info.yml β βββ app-commands.md β βββ creating-python-environment-windows.md β βββ discord-embed-limits.md β βββ discord-messages-with-colors.md β βββ discordpy-subclassing-context.md β βββ discordpy.md β βββ discordpy_help_command.md β βββ docker-hosting-guide.md β βββ fix-ssl-certificate.md β βββ keeping-tokens-safe.md β βββ mutability.md β βββ parameters-and-arguments.md β βββ proper-error-handling.md β βββ setting-different-statuses-on-your-bot.md β βββ subclassing_bot.md β βββ vps-services.md β βββ why-not-json-as-database.md βββ privacy.md βββ rules.md βββ security-notice.md βββ server-info β βββ _info.yml β βββ roles.md β βββ staff-role-expectations.md βββ tags βββ _info.yml ```A fully expanded tree for all contributing pages
``` . βββ _info.yml βββ bot-extended-configuration-options.md βββ bot.md βββ cloning-repository.md βββ commit-messages.md βββ configure-environment-variables.md βββ contributing-guidelines.md βββ creating-bot-account.md βββ docker.md βββ forking-repository.md βββ hosts-file.md βββ installing-project-dependencies.md βββ issues.md βββ linting.md βββ logging.md βββ obtaining-discord-ids.md βββ pull-requests.md βββ setting-test-server-and-bot-account.md βββ sir-lancebot β βββ _info.yml β βββ env-var-reference.md βββ sir-lancebot.md βββ site.md βββ style-guide.md βββ working-with-git β βββ _info.yml β βββ cli.md β βββ pycharm.md βββ working-with-git.md ```