retype icon indicating copy to clipboard operation
retype copied to clipboard

Add optional sections to the left sidebar

Open patricklafrance opened this issue 2 years ago • 7 comments

Hello!

I was wondering if you would consider adding optional sections to the left sidebar?

Currently, I can easily add multiple level of collapsible folders:

root
    /folder A
        /folder AA
             /folder AAA
                 page
    /folder B
    .....

What I would like to do is separating those folders by sections:

root
   Section 1
        /folder A
        /folder AA
             /folder AAA
                 page
         /folder B
   Section 2
         /folder C

Similar to how Storybook is doing it:

image

But maybe with a look that is more similar to React Spectrum:

image

One use case that we currently have is for the following Retype website: https://gsoft-inc.github.io/wl-web-configs/ for which at some point we will deprecate tools that we stopped using. We would like to keep the tool documentation but move it to a "Legacy" section at the bottom of the sidebar:

web-configd
    /browserslist
    /eslint
    /stylelint
    .....

   Legacy Section  <---
   /postcss

Another use case, is for our future "hub" website for which we will want to distinguish our backend and frontend documentation sites in the sidebar, something like:

hub
   Backend
       ...
   Frontend
      web-configs (link to https://gsoft-inc.github.io/wl-web-configs/)
      @squide (link to https://gsoft-inc.github.io/wl-squide/)
      ...

Let me know what you think!

Thank you

patricklafrance avatar Sep 08 '23 18:09 patricklafrance

Another example from the new Bun 1.0 documentation :)

image

patricklafrance avatar Sep 09 '23 00:09 patricklafrance

This is the best I have been able to come up with so far with Retype:

image

patricklafrance avatar Sep 09 '23 01:09 patricklafrance

It could be configured with a default.md or index.yaml file.

A type option could be added, accepting either a folder or section value. Default would be folder.

patricklafrance avatar Sep 09 '23 05:09 patricklafrance

~~If you decide to work on this feature, that would also be appreciated if the links of the sections could refer to external links.~~

~~Given the follow hub:~~

image

~~If I want to add links refering to the "Squide" and "Web configs" sites to my left sidebar:~~

sidebar
├── Frontend
├──── Squide
├──── Web configs

~~I must use the redirect property:~~

---
label: "Squide"
redirect: https://gsoft-inc.github.io/wl-squide
---

~~That's not great because it's a JavaScript redirect rather than a native hyperlink.~~

Thank you,

Patrick

patricklafrance avatar Sep 25 '23 23:09 patricklafrance

Another thing that could be great if you choose to work on this, would be to statically render the new sections and links rather than relying on JavaScript as it's currently done.

With the current implementation, when navigating between the hub sites, there is a loading time before the sidebar is displayed that could be avoided if the sections and link were statically generated:

menu-loading

Spectrum hub's sites are all statically generated. Here's the result of a similar test:

spectrum-hub

Let me know what you think!

Thank you,

Patrick

patricklafrance avatar Sep 25 '23 23:09 patricklafrance

That's not great because it's a JavaScript redirect rather than a native hyperlink.

The js redirect is only if the page is browsed to directly. Retype will replace any links within the project that link to the .md file with a static link directly to the external URL and not the .md page. So unless the page is directly linked into from an external source, the js redirect will not be triggered.

geoffreymcgill avatar Sep 26 '23 01:09 geoffreymcgill

That's not great because it's a JavaScript redirect rather than a native hyperlink.

The js redirect is only if the page is browsed to directly. Retype will replace any links within the project that link to the .md file with a static link directly to the external URL and not the .md page. So unless the page is directly linked to, the js redirect will not be triggered.

Oh, you're right, sorry my bad!

patricklafrance avatar Sep 26 '23 02:09 patricklafrance