Open gdisk opened 13 hours ago
Thanks for the report :raised_hands:
Component overrides composition in plugins is a bit tricky right now and in this specific case pretty difficult to fix. There is ongoing work in Starlight to refactor the locator the location of route data (from props to a middleware) which will make it easier for plugins to change route data without having to override some component.
When this refactor is done and released in Starlight itself, most of the work currently being done in the blog Sidebar
component override will no longer be necessary which will make it easier to compose plugins. I'm actively following this work and will update this plugin as soon as the refactor is released.
thanks for reply!
anywhere, i resolved the problem by custom the sidebar in startlight, here is the code:
// astro.config.mjs
import starlightBlog from 'starlight-blog'
import starlightImageZoom from 'starlight-image-zoom';
import starlightUtils from "@lorenzo_lewis/starlight-utils";
export const BLOG_PREFIX = "blogs";
export default defineConfig({
...
integrations: [
starlight({
title: "iDOC",
logo: {
src: "./src/assets/logo.svg",
},
plugins: [
starlightImageZoom(),
starlightUtils({
multiSidebar: {
switcherStyle: "dropdown",
},
}),
starlightBlog({
title: "My Blog",
prefix: BLOG_PREFIX,
}),
],
components: {
Sidebar: "./src/components/Sidebar.astro",
},
...
}),
...
],
});
// Sidebar.astro
---
import type { Props } from "@astrojs/starlight/props";
import BlogSidebar from "starlight-blog/overrides/Sidebar.astro";
import MultiSidebar from "@lorenzo_lewis/starlight-utils/components/Sidebar.astro";
import { BLOG_PREFIX } from "astro.config.mjs";
const { slug } = Astro.props;
const isBlog = slug.startsWith(BLOG_PREFIX);
---
{
isBlog && (
<BlogSidebar {...Astro.props}>
<slot />
</BlogSidebar>
)
}
{
!isBlog && (
<MultiSidebar {...Astro.props}>
<slot />
</MultiSidebar>
)
}
Describe the bug
hello,i want to use this plugin with starlight-utils plugin at the same time, but when i use them together, it seems can not work correctly。codes like below:
bug details:
can you help me? so thanks!
To Reproduce
Expected behavior
both docs sidebar and blogs sidebar works well.
How often does this bug happen?
Every time
System Info
No response
Additional Context
No response