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

Improve the sidebar generator #481

Merged
merged 1 commit into from
Jul 3, 2024
Merged

Conversation

ptgott
Copy link
Contributor

@ptgott ptgott commented Jul 2, 2024

Improve the sidebar generator to accommodate the reorganized docs site.

  • Alphabetize auto-generated sidebar entries.

    The exception is any page that includes "Introduction" or
    "introduction" in the title. Elevate these to the first entry to avoid
    a confusing sidebar order.

  • Show third-level category pages in the sidebar without showing their
    contents. This way, we can add content one level beyond the level
    permitted in the sidebar while still showing the category page for
    that content in the sidebar.

  • Allow for a category page to be at the same level as its associated
    subdirectory. This is to accommodate the Terraform Provider reference
    which, because of the way it's generated, can only include a category
    page outside of its associated subdirectory. This does not abide by
    the Docusaurus convention, so we will need to figure out a solution
    eventually, but this is a quick alternative to tide us over.

@ptgott ptgott requested a review from avatus as a code owner July 2, 2024 17:26
Copy link

vercel bot commented Jul 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 3, 2024 4:57pm

@ptgott ptgott marked this pull request as draft July 2, 2024 18:51
@ptgott ptgott force-pushed the paul.gottschling/2024-07-sidebar-a-z branch from 67e5c04 to cf03cc5 Compare July 2, 2024 19:04
@ptgott ptgott marked this pull request as ready for review July 2, 2024 19:05
@ptgott ptgott marked this pull request as draft July 2, 2024 21:00
@ptgott ptgott force-pushed the paul.gottschling/2024-07-sidebar-a-z branch from cf03cc5 to 21a3604 Compare July 2, 2024 21:11
@ptgott ptgott marked this pull request as ready for review July 2, 2024 21:35
@ptgott ptgott changed the title Alphabetize auto-generated sidebar entries Improve the sidebar generator Jul 2, 2024
@ptgott ptgott force-pushed the paul.gottschling/2024-07-sidebar-a-z branch from 8b08a80 to a1096ae Compare July 3, 2024 16:04
@ptgott ptgott force-pushed the paul.gottschling/2024-07-sidebar-a-z branch from a1096ae to e221aa9 Compare July 3, 2024 16:17
avatus
avatus previously approved these changes Jul 3, 2024
@@ -72,6 +72,39 @@ const getEntryForPath = (fs, filePath) => {
};
};

const sortByTitle = (a, b) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a comment here describing the algorithm chosen for sorting? "if it includes this, sort alphabetically, otherwise go by title" or whatever

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in 52328f0

Improve the sidebar generator to accommodate the reorganized docs site.

- Alphabetize auto-generated sidebar entries.

  The exception is any page that includes "Introduction" or
  "introduction" in the title. Elevate these to the first entry to avoid
  a confusing sidebar order.

- Show third-level category pages in the sidebar without showing their
  contents. This way, we can add content one level beyond the level
  permitted in the sidebar while still showing the category page for
  that content in the sidebar.

- Allow for a category page to be at the same level as its associated
  subdirectory. This is to accommodate the Terraform Provider reference
  which, because of the way it's generated, can only include a category
  page outside of its associated subdirectory. This does not abide by
  the Docusaurus convention, so we will need to figure out a solution
  eventually, but this is a quick alternative to tide us over.

- Only add ".mdx" files to the sidebar. Otherwise, the generator
  attempts to add vim swapfiles etc.
@ptgott ptgott force-pushed the paul.gottschling/2024-07-sidebar-a-z branch from afda6d7 to 52328f0 Compare July 3, 2024 16:49
@ptgott ptgott requested a review from avatus July 3, 2024 16:50
@ptgott ptgott merged commit 0ff38c1 into main Jul 3, 2024
8 of 9 checks passed
travelton pushed a commit that referenced this pull request Aug 26, 2024
Improve the sidebar generator to accommodate the reorganized docs site.

- Alphabetize auto-generated sidebar entries.

  The exception is any page that includes "Introduction" or
  "introduction" in the title. Elevate these to the first entry to avoid
  a confusing sidebar order.

- Show third-level category pages in the sidebar without showing their
  contents. This way, we can add content one level beyond the level
  permitted in the sidebar while still showing the category page for
  that content in the sidebar.

- Allow for a category page to be at the same level as its associated
  subdirectory. This is to accommodate the Terraform Provider reference
  which, because of the way it's generated, can only include a category
  page outside of its associated subdirectory. This does not abide by
  the Docusaurus convention, so we will need to figure out a solution
  eventually, but this is a quick alternative to tide us over.

- Only add ".mdx" files to the sidebar. Otherwise, the generator
  attempts to add vim swapfiles etc.
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

Successfully merging this pull request may close these issues.

2 participants