You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support integration with starlight-sidebar-topics plugin #9
For a large documentation multiple sections/topics can be helpful. I am using this plugin, but using starlight-theme-obsidian will override this plugin.
I wonder is it possible to take the sidebar from this plugin and inject into the obsidian theme?
Or can we integrate the same features into this theme.
I understand that this would be very interesting to have from a convenience standpoint, but in my eyes, I feel like Starlight plugins in general should be as self-contained as possible.
Adding more packages would risk making the theme more bloated and even less compatible with other packages. Personally, I already feel quite iffy about including the starlight-site-graph plugin out-of-the-box.
I am not sure what the optimal solution would be, some ideas:
Just add the starlight-sidebar-topics package to this theme as-is.
Split the starlight-theme-obsidian into one that is just the centered reading and CSS styling, and another that adds all packages that one might want to fully create an Obsidian Publish-esque website.
Create an extensions/ directory which provides compatible Sidebar overrides for e.g. starlight-sidebar-topics
Somehow allow the Sidebar override to users to add in their own components in the sidebar in an extendible way, I guess name slots could work for that?
I don't know about others, but for me I just want a theme with good features out of the box, and configurable.
Really like the site graph option.
We can provide options in config to control whether the sidebar should be rendered.
For a large documentation site, I believe this sidebar by topics feature is a necessary.
For me, I put blog and tutorials into separate topics. https://docs.kunkun.sh/guides/get-started/
Otherwise they could be hidden under a long list of notes, and don't get discovered by readers.
I'm not a fan of the site graph's current implementation. I do see the premise and it's super nifty but it needs some work and is also not suitable to my usecase right now.
Speaking of, I'm trying to work on a documentation site for a scripting language with hundreds of functions, so that's a lot of pages to cover. So I really need sidebar topics in my case to help scope down a larger site. I also really like this theme which has a slick minimalistic style that gets out of the way and helps to focus on the content.
So what I have done to resolve the co-existence is create a custom override of the sidebar component that combines both the theme and the plugin together:
---importDefaultfrom'@astrojs/starlight/components/Sidebar.astro';importSearchfrom'@astrojs/starlight/components/Search.astro';importSiteTitlefrom'@astrojs/starlight/components/SiteTitle.astro';importMobileMenuFooterfrom'@astrojs/starlight/components/MobileMenuFooter.astro';importconfigfrom'virtual:starlight/user-config';importTopicsfrom'./Topics.astro';const shouldRenderSearch =config.pagefind||config.components.Search!=='@astrojs/starlight/components/Search.astro';const { hasSidebar } =Astro.locals.starlightRoute;const { isPageWithTopic } =Astro.locals.starlightSidebarTopics;---{/* (STARLIGHT-THEME-OBSIDIAN): Reorder site sidebar to always contain site title */}
<divclass="sidebar-top">
<divclass="title-wrapper ">
<SiteTitle/>
</div>
{shouldRenderSearch&& <Search/>}
<MobileMenuFooter/>
</div>
{hasSidebar&&isPageWithTopic&& <Topics />}
<Default><slot /></Default>
Of course the danger here is if the theme or plugin are updated I have to mind maintaining this override. I'm also thinking of replacing the search component in the future so this may find itself dealing with a third integration on top as well.
I'm not a fan of the site graph's current implementation. I do see the premise and it's super nifty but it needs some work and is also not suitable to my usecase right now.
Yeah, I completely understand where you are coming from. I wish I could say that I have been able to come up with a better solution to decouple this theme from the sitegraph, but I haven't yet.
If you don't mind, could you elaborate a bit on what parts of the site graph needs more work? Do you specifically mean the way it is implemented in the theme, the way it looks/works, how it parses your site, ...?
So what I have done to resolve the co-existence is create a custom override of the sidebar component that combines both the theme and the plugin together:
...
Of course the danger here is if the theme or plugin are updated I have to mind maintaining this override. I'm also thinking of replacing the search component in the future so this may find itself dealing with a third integration on top as well.
That's a nice solution! In my opinion, I think the burden of maintenance for your override should be rather small. Barring a complete redesign of the vanilla Starlight theme, the structure of the <Sidebar> component should stay mostly the same -- I'm not planning to make any large changes to it, in any case.
For the immediate future (a.k.a. until I figured out a better solution), I think I will try work on point (3.) and see if it is feasible to expose some 'official' support for various plugins via custom <Sidebar>/<PageSidebar>/... overrides.
As a final note: I can also recommend checking out the Starlight NextJS Theme, which also sports a centered reading feature, but doesn't override any components to do so.
Activity
Fevol commentedon Mar 22, 2025
I understand that this would be very interesting to have from a convenience standpoint, but in my eyes, I feel like Starlight plugins in general should be as self-contained as possible.
Adding more packages would risk making the theme more bloated and even less compatible with other packages. Personally, I already feel quite iffy about including the
starlight-site-graphplugin out-of-the-box.I am not sure what the optimal solution would be, some ideas:
starlight-sidebar-topicspackage to this theme as-is.starlight-theme-obsidianinto one that is just the centered reading and CSS styling, and another that adds all packages that one might want to fully create an Obsidian Publish-esque website.extensions/directory which provides compatibleSidebaroverrides for e.g.starlight-sidebar-topicsSidebaroverride to users to add in their own components in the sidebar in an extendible way, I guess name slots could work for that?Example code for 3/4
//
starlight-theme-obsidian/overrides/Sidebar.astro//
YOUR-WEBSITE/overrides/Sidebar.astroI could see the benefits for each of the four ideas, I'll need to think about this (and perhaps discuss this with some of the Starlight maintainers)
HuakunShen commentedon Mar 22, 2025
I don't know about others, but for me I just want a theme with good features out of the box, and configurable.
Really like the site graph option.
We can provide options in config to control whether the sidebar should be rendered.
For a large documentation site, I believe this sidebar by topics feature is a necessary.
For me, I put blog and tutorials into separate topics. https://docs.kunkun.sh/guides/get-started/
Otherwise they could be hidden under a long list of notes, and don't get discovered by readers.
Martin-Pitt commentedon Jul 9, 2025
I'm not a fan of the site graph's current implementation. I do see the premise and it's super nifty but it needs some work and is also not suitable to my usecase right now.
Speaking of, I'm trying to work on a documentation site for a scripting language with hundreds of functions, so that's a lot of pages to cover. So I really need sidebar topics in my case to help scope down a larger site. I also really like this theme which has a slick minimalistic style that gets out of the way and helps to focus on the content.
So what I have done to resolve the co-existence is create a custom override of the sidebar component that combines both the theme and the plugin together:
Of course the danger here is if the theme or plugin are updated I have to mind maintaining this override. I'm also thinking of replacing the search component in the future so this may find itself dealing with a third integration on top as well.
Fevol commentedon Jul 9, 2025
Yeah, I completely understand where you are coming from. I wish I could say that I have been able to come up with a better solution to decouple this theme from the sitegraph, but I haven't yet.
If you don't mind, could you elaborate a bit on what parts of the site graph needs more work? Do you specifically mean the way it is implemented in the theme, the way it looks/works, how it parses your site, ...?
That's a nice solution! In my opinion, I think the burden of maintenance for your override should be rather small. Barring a complete redesign of the vanilla Starlight theme, the structure of the
<Sidebar>component should stay mostly the same -- I'm not planning to make any large changes to it, in any case.For the immediate future (a.k.a. until I figured out a better solution), I think I will try work on point (3.) and see if it is feasible to expose some 'official' support for various plugins via custom
<Sidebar>/<PageSidebar>/... overrides.As a final note: I can also recommend checking out the Starlight NextJS Theme, which also sports a centered reading feature, but doesn't override any components to do so.
feat: support starlight-sidebar-topics (#9)