Skip to content
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

Menu-insertion through post meta #47

Open
Swader opened this issue Mar 26, 2020 · 0 comments
Open

Menu-insertion through post meta #47

Swader opened this issue Mar 26, 2020 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Swader
Copy link
Contributor

Swader commented Mar 26, 2020

A limitation of Docusaurus V1 is that in order to include a page in multiple sidebars, you have to have a clone of the page. Otherwise, the page doesn't know which sidebar it would belong to when opened, and wouldn't know what to render on the side - i.e. which context it's appearing in.

There are three solutions:

  1. Update to Docusaurus V2.
  2. Write a mirror script which is run pre-build or on manual request and creates mirror entries of desired pages, add mirrors manually to sidebar.
  3. Write a pre-build parser which reads page metadata and builds the menus from that.

The first option is not feasible right now, too much work before we have all the content.

Options 2 and 3 both ignore the problem from the intro paragraph - the page being rendered will have to default to one context, potentially creating minor confusion. I.e. open "guideX" from Product API, but the same guide is linked in the Article API menus. If you click it from Article API, the sidebar being rendered will be from Product API, creating a disjointed experience.

A solution to this would be to write a JS hack which copies the sidebar and overwrites from localstorage (functionality already exists) on links with certain CSS selectors.

Because a recipe can appear in more than 1 menu, mirroring might prove to be too chaotic. A page appearing in 3 menus would require us to add the pages into three menus, and there would be two mirror files created, not one. This gets more complex as pages appear in more menus.

Right now I'm leaning towards option 3, which would use something like:

menus: api-intro-article:recipes, api-intro-custom:recipes

... to insert the links into the build files after build processing is done, but option 2 sounds okay too if automated properly.

Leaving this open-ended, for now we'll limit things to one menu per page.

@Swader Swader added enhancement New feature or request help wanted Extra attention is needed labels Mar 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant