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

Updates section navigation #92

Merged
merged 1 commit into from
Mar 1, 2024
Merged

Updates section navigation #92

merged 1 commit into from
Mar 1, 2024

Conversation

h-enk
Copy link
Member

@h-enk h-enk commented Feb 26, 2024

Summary

Brief explanation of the proposed changes.

  • Sidebar
  • Auto generate section menu (default), or
  • Configure section menu (partly automated):
[[sidebar_docs]]
  name = "Start here"
  pageRef = "/docs/start-here"
  weight = 10

[[sidebar_docs]]
  name = "Guides"
  pageRef = "/docs/guides"
  weight = 20

[[sidebar_docs]]
  name = "Reference"
  pageRef = "/docs/reference"
  weight = 30

Sections are not collapsed (default), override per section in the frontmatter of the section's _index.md:

---
sidebar:
  collapsed: true
---

Works with:

pnpm run create --kind docs guides

Basic example

Include a basic example, screenshots, or links.

Snag_1481292

Motivation

Why are we doing this? What use cases does it support? What is the expected outcome?

More robust, simplified, and powerful code with more features and easier expandability possibilities for for example badges, icons, and target attribute.

Checks

  • Read Create a Pull Request
  • Supports all screen sizes (if relevant)
  • Supports both light and dark mode (if relevant)
  • Passes npm run test

@h-enk h-enk merged commit 52ed2e9 into main Mar 1, 2024
@h-enk h-enk deleted the sidebar-navigation branch March 1, 2024 11:22
<nav {{ if eq site.Params.doks.menu.section.collapsibleSidebar false }}id="sidebar-default" {{ end }}class="docs-links" aria-label="Main navigation">
{{ partial "sidebar/docs-menu.html" . }}
</nav>
{{ partial "sidebar/section-menu.html" . }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I don't have understand but this parameter is not used site.Params.doks.menu.section.collapsibleSidebar?

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct. Now, when no sidebar_<section> menu entries are found, Doks automatically generates a sidebar based on the filesystem structure of your documentation — no parameter needed. The new setup is a lot smarter and more robust.

Copy link
Contributor

@kosssi kosssi Mar 9, 2024

Choose a reason for hiding this comment

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

Thanks for your response, I don't understand how can I get the same design like this (without colapse) before this commit :

image

not like this (last version)

image

I don't want colapse menu ;)

@kosssi
Copy link
Contributor

kosssi commented Mar 12, 2024

I understand my issue better. This commit changes the design since it is no longer possible to have a menu without <details> without overload the layout, if I'm not mistaken?

Before sidebar/auto-default-menu.html allowed it ;)

@h-enk
Copy link
Member Author

h-enk commented Mar 12, 2024

Yes, that's correct. So. if you'd like to keep the old design you could copy https://github.com/gethyas/doks-core/blob/v1.3.0/layouts/partials/sidebar/auto-default-menu.html and paste as layouts/partials/sidebar/section-menu.html

Snag_14dbe89a

And, make sure to check/update for the old styling — add overrides in assets/scss/common/_custom.scss

@h-enk
Copy link
Member Author

h-enk commented Mar 12, 2024

Or, you could override the new render method https://github.com/gethyas/doks-core/blob/v1.4.1/layouts/partials/sidebar/render-section-menu.html and strip out the details-summary part

@kosssi
Copy link
Contributor

kosssi commented Mar 12, 2024

I don't want to deviate too much from Doks otherwise it will complicate the update.

I especially wanted you to be aware if you hadn't seen the problem ;)

@h-enk
Copy link
Member Author

h-enk commented Mar 12, 2024

I understand that — thanks

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.

None yet

2 participants