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

Fix the way the sidebar renders top-level category index pages #87

Open
ptgott opened this issue Dec 27, 2024 · 3 comments
Open

Fix the way the sidebar renders top-level category index pages #87

ptgott opened this issue Dec 27, 2024 · 3 comments

Comments

@ptgott
Copy link
Contributor

ptgott commented Dec 27, 2024

There are two problems with how the docs sidebar renders top-level docs category pages, e.g., "Admin Guides" and "User Guides":

  • Top-level category index pages appear twice in the sidebar, once as an expandable section and once as a page within that section, and not necessarily the top page.
  • Unlike sidebar categories at or after the second level, top-level categories do not link to their index pages when a user clicks on them.

For example, the section of the sidebar for "Admin Guides" includes the "Teleport Admin Guides" page as a page within the category, when it should be the page that readers visit when they click "Admin Guides".

Image

Fix the docs site configuration so that clicking top-level categories on the sidebar navigates to the relevant index page.

@ptgott
Copy link
Contributor Author

ptgott commented Jan 3, 2025

The sidebar generator is in node_modules/@docusaurus/plugin-content-docs/lib/sidebars/generator.js. What's strange is that, if I add the following console log to the end of the file...

     const docs = getAutogenDocs();
     const fsModel = treeify(docs);
+    console.log("fsModel", JSON.stringify(fsModel, undefined, 2));
     const sidebarWithPosition = generateSidebar(fsModel);
     const sortedSidebar = sortItems(sidebarWithPosition);
     return sortedSidebar;

The fsModel does contain the intended category index pages, but does not assign them entries. You can see this with reference.mdx in the output snippet below:

fsModel {
  "backends.mdx": "reference/backends",
  "cloud-faq.mdx": "reference/cloud-faq",
  "config.mdx": "reference/config",
  "join-methods.mdx": "reference/join-methods",
  "networking.mdx": "reference/networking",
  "predicate-language.mdx": "reference/predicate-language",
  "reference.mdx": "reference/reference",
  "resources.mdx": "reference/resources",
  "signals.mdx": "reference/signals",
  "signature-algorithms.mdx": "reference/signature-algorithms",
  "user-types.mdx": "reference/user-types",
  "access-controls": {
    "access-controls.mdx": "reference/access-controls/access-controls",
    "access-lists.mdx": "reference/access-controls/access-lists",
    "authentication.mdx": "reference/access-controls/authentication",
    "login-rules.mdx": "reference/access-controls/login-rules",
    "roles.mdx": "reference/access-controls/roles",
    "saml-idp.mdx": "reference/access-controls/saml-idp"
  },
// [...]

@ptgott
Copy link
Contributor Author

ptgott commented Jan 6, 2025

I propose we:

@ptgott ptgott changed the title Top-level category index pages appear twice in the sidebar Fix top-level category index pages Feb 21, 2025
@ptgott ptgott changed the title Fix top-level category index pages Fix the way the sidebar renders top-level category index pages Feb 21, 2025
@ptgott
Copy link
Contributor Author

ptgott commented Feb 25, 2025

A related issue: https://goteleport.com/docs/connect-your-client renders without a sidebar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant