diff --git a/src/overrides/Sidebar.astro b/src/overrides/Sidebar.astro index f34573c5b..fd98f2735 100644 --- a/src/overrides/Sidebar.astro +++ b/src/overrides/Sidebar.astro @@ -1,9 +1,10 @@ --- -// Heavily inspired from https://github.com/lorenzolewis/starlight-multi-sidebar/blob/main/src/components/Sidebar.astro +// Heavily inspired from starlight-utils (https://github.com/lorenzolewis/starlight-utils) — adapted so we can disable for blog pages import type { Props } from "@astrojs/starlight/props"; import StarlightSidebar from "@astrojs/starlight/components/Sidebar.astro"; import BlogSidebar from "starlight-blog/overrides/Sidebar.astro"; import { AstroError } from "astro/errors"; +import { Icon } from "@astrojs/starlight/components"; const sidebarConfig: [string, boolean, Props][] = Astro.props.sidebar.map( (s) => { @@ -13,7 +14,7 @@ const sidebarConfig: [string, boolean, Props][] = Astro.props.sidebar.map( Each top-level \`sidebar\` item in the Starlight config must be either a group or autogenerated. - See https://starlight.astro.build/guides/sidebar/#groups and https://starlight.astro.build/guides/sidebar/#autogenerated-groups` + See https://starlight.astro.build/guides/sidebar/#groups and https://starlight.astro.build/guides/sidebar/#autogenerated-groups`, ); } @@ -21,7 +22,7 @@ const sidebarConfig: [string, boolean, Props][] = Astro.props.sidebar.map( s.type === "link" ? s.isCurrent : s.entries.some(isCurrent); return [s.label, isCurrent(s), { ...Astro.props, sidebar: [...s.entries] }]; - } + }, ); const isBlog = Astro.url.pathname.split("/")[1] === "blog"; @@ -33,67 +34,102 @@ const isBlog = Astro.url.pathname.split("/")[1] === "blog"; ) : ( -
+ + {sidebarConfig.map(([label, isCurrent, props]) => ( - <> - -
- - - -
- + ))} -
+ ) } + +