Make it easier to add sidebar entries dynamically #3452
rzane
started this conversation in
Feature Requests
Replies: 1 comment 2 replies
-
|
Hi @rzane 👋
Could you clarify the use case here a bit? What are the collections you’re looking to reference? Are these Astro content collections other than |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What version of
starlightare you using?0.36.0
What is your idea?
The
sidebarproperty inastro.config.tsallows you to specify sidebar entries, but doesn't allow you to reference collections.After struggling to find a solution to this problem, I eventually read the source code for the sidebar component and realized I could manipulate the locals in a middleware to add entries to the sidebar.
However, this becomes relatively complicated since:
isCurrentSidebarEntry,SidebarLink, andSidebarGroupare not exported. There's a workaround, but it is a minor inconvenience (see Re-export SidebarLink, SidebarGroup, and SidebarEntry types for consumer use #3411).Points 1 and 2 could be solved by either exporting functions to recompute that data after changing the sidebar, or applying those changes in a middleware that runs after user defined middleware.
Why is this feature necessary?
Since the framework revolves around collections, it's really unintuitive that I can't easily incorporate them into my sidebar.
Do you have examples of this feature in other projects?
No response
Participation
Beta Was this translation helpful? Give feedback.
All reactions