···11+---
22+"starlight-sidebar-topics-dropdown": minor
33+---
44+55+⚠️ **BREAKING CHANGE:** The Starlight Sidebar Topics Dropdown plugin no longer provides the same ["Unnested Sidebar" configuration](https://starlight-sidebar-topics-dropdown.trueberryless.org/docs/guides/unnested-sidebar/) like before. Please adapt your `astro.config.mjs` with the up-to-date guide on [how to configure a "Unnested Sidebar"](https://starlight-sidebar-topics-dropdown.trueberryless.org/docs/guides/unnested-sidebar/#configure-an-unnested-sidebar).
+11
.changeset/quick-baths-dig.md
···11+---
22+"starlight-sidebar-topics-dropdown": minor
33+---
44+55+⚠️ **BREAKING CHANGE:** The minimum supported version of Starlight is now version `0.32.0`.
66+77+Please use the `@astrojs/upgrade` command to upgrade your project:
88+99+```sh
1010+npx @astrojs/upgrade
1111+```
+5
.changeset/whole-pants-sit.md
···11+---
22+"starlight-sidebar-topics-dropdown": minor
33+---
44+55+⚠️ **BREAKING CHANGE:** The Starlight Sidebar Topics Dropdown plugin no longer [overrides](https://starlight.astro.build/guides/overriding-components/) the [`<Pagination>` component](https://starlight.astro.build/reference/overrides/#pagination). If you were manually rendering `starlight-sidebar-topics-dropdown/overrides/Pagination.astro` in a custom override, you can now remove it.
···140140An optional unique identifier for the topic that can be used to associate content pages that are not listed in any topic sidebar configuration with this topic.
141141142142```js {5}
143143-starlightSidebarTopics([
143143+StarlightSidebarTopicsDropdown([
144144 {
145145 label: "Guides",
146146 link: "/guides/",
···20202121## Configure an unnested sidebar
22222323-To configure an unnested sidebar, set the `label` option of the `items` array to `""` for all sidebar groups in the topic configuration where you want to display a single-level sidebar.
2323+To configure an unnested sidebar, list the items directly inside the [`items` topic array](/docs/configuration#items) using the `slug` option provided by the [`SidebarItem` type](https://starlight.astro.build/reference/configuration/#sidebaritem). Starlight Sidebar Topics Dropdown Plugin automatically applies CSS to make the items look right.
2424+2525+Unfortunately, there is no option for autogenerating an unnested sidebar, which is currently a limitation by Starlight.
24262527Here is an example of this feature:
2628···3739 link: "/unnested-sidebar/",
3840 icon: "right-caret",
3941 items: [
4040- { label: "", autogenerate: { directory: "unnested-sidebar" } },
4242+ { slug: "unnested-sidebar" },
4343+ { slug: "unnested-sidebar/lorem-ipsum" },
4144 ],
4245 },
4346 ]),
···4851```
49525053You can see how the sidebar is displayed in the [Unnested Sidebar](/unnested-sidebar/lorem-ipsum/) topic.
5151-5252-:::note
5353-Please note, that this feature only works under two conditions:
5454-5555-1. The `label` option of the `items` array must be set to `""`.
5656-2. The `items` array must contain only **one item**.
+6
docs/src/content/docs/index.mdx
···2929 Edit your config in the `astro.config.mjs` file.
3030 </Card>
3131</CardGrid>
3232+3333+## Contributors
3434+3535+import { ContributorList } from "starlight-contributor-list";
3636+3737+<ContributorList githubRepo="trueberryless-org/starlight-sidebar-topics-dropdown" />
···11+---
22+title: Lorem ispum
33+---
44+55+:::note
66+This page exists solely for demonstration purposes and contains no useful information.
77+See the Starlight Multiple Sidebar Dropdown plugin [Unnested Sidebar Guide](/docs/guides/unnested-sidebar/) for more information.
88+:::
99+1010+Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
···11+---
22+title: Lorem ispum 2
33+---
44+55+:::note
66+This page exists solely for demonstration purposes and contains no useful information.
77+See the Starlight Multiple Sidebar Dropdown plugin [Unnested Sidebar Guide](/docs/guides/unnested-sidebar/) for more information.
88+:::
99+1010+Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
···66 throw new AstroError(
77 message,
88 hint ??
99- `See the error report above for more informations.\n\nIf you believe this is a bug, please file an issue at https://github.com/HiDeoo/starlight-sidebar-topics-dropdown/issues/new/choose`
99+ `See the error report above for more informations.\n\nIf you believe this is a bug, please file an issue at https://github.com/trueberryless-org/starlight-sidebar-topics-dropdown/issues/new/choose`
1010 );
1111}
1212
···11+import type { StarlightSidebarTopicsDropdownSharedConfig } from "./config";
22+33+/**
44+ * We keep track of the current topic configuration using a variable stored using `Astro.locals` which will be reset for
55+ * each new page. The value is tracked using an untyped symbol on purpose to avoid users to get autocomplete for it and
66+ * avoid potential clashes with user-defined variables.
77+ */
88+export const StarlightSidebarTopicsDropdownLocalsSymbol = Symbol.for(
99+ "starlight-sidebar-topics-dropdown:locals"
1010+);
1111+1212+export interface StarlightSidebarTopicsDropdownLocals {
1313+ config: StarlightSidebarTopicsDropdownSharedConfig[number];
1414+}
···11+import type { StarlightUserConfig } from "@astrojs/starlight/types";
22+import type { AstroIntegrationLogger } from "astro";
33+44+export function overrideStarlightComponent(
55+ components: StarlightUserConfig["components"],
66+ logger: AstroIntegrationLogger,
77+ override: keyof NonNullable<StarlightUserConfig["components"]>,
88+ component: string
99+) {
1010+ if (components?.[override]) {
1111+ logger.warn(
1212+ `It looks like you already have a \`${override}\` component override in your Starlight configuration.`
1313+ );
1414+ logger.warn(
1515+ `To use \`starlight-sidebar-topics-dropdown\`, either remove your override or update it to render the content from \`starlight-sidebar-topics-dropdown/components/${component}.astro\`.`
1616+ );
1717+ // if (component === "DynamicVersionBadge") {
1818+ // logger.warn(
1919+ // "Notice that the `DynamicVersionBadge` component must be rendered AFTER the original Starlight `SiteTitle` component in the DOM. This ensures proper layout and behavior within the application."
2020+ // );
2121+ // }
2222+2323+ return {};
2424+ }
2525+2626+ return {
2727+ [override]: `starlight-sidebar-topics-dropdown/overrides/${override}.astro`,
2828+ };
2929+}
···11+import { defineRouteMiddleware } from "@astrojs/starlight/route-data";
22+import config from "virtual:starlight-sidebar-topics-dropdown/config";
33+44+import {
55+ StarlightSidebarTopicsDropdownLocalsSymbol,
66+ type StarlightSidebarTopicsDropdownLocals,
77+} from "./libs/locals";
88+import { throwPluginError } from "./libs/plugin";
99+import {
1010+ getCurrentTopic,
1111+ isTopicFirstPage,
1212+ isTopicLastPage,
1313+} from "./libs/sidebar";
1414+1515+export const onRequest = defineRouteMiddleware((context) => {
1616+ const { starlightRoute } = context.locals;
1717+ const { entry, id, pagination, sidebar } = starlightRoute;
1818+1919+ if (entry["data"].template !== "splash") {
2020+ const currentTopic = getCurrentTopic(config, sidebar, id, entry);
2121+2222+ if (!currentTopic)
2323+ throwPluginError(
2424+ `Failed to find the topic for the \`${id}\` page.`,
2525+ `Either include this page in the sidebar configuration of the desired topic using the \`items\` property or to associate an unlisted page with a topic, use the \`topic\` frontmatter property and set it to the desired topic ID.
2626+ Learn more about unlisted pages in the ["Unlisted pages"](https://starlight-sidebar-topics-dropdown.trueberryless.org/docs/guides/unlisted-pages/) guide.`
2727+ );
2828+2929+ starlightRoute.sidebar = currentTopic.sidebar;
3030+ // @ts-expect-error - See `libs/locals` for more information.
3131+ context.locals[StarlightSidebarTopicsDropdownLocalsSymbol] = {
3232+ config: currentTopic.config,
3333+ } satisfies StarlightSidebarTopicsDropdownLocals;
3434+3535+ if (isTopicFirstPage(sidebar, id)) {
3636+ pagination.prev = undefined;
3737+ }
3838+3939+ if (isTopicLastPage(sidebar, id)) {
4040+ pagination.next = undefined;
4141+ }
4242+ }
4343+});
···11---
22import Default from '@astrojs/starlight/components/Sidebar.astro'
33-import type { Props } from '@astrojs/starlight/props'
44-import config from 'virtual:starlight-sidebar-topics-dropdown/config'
55-66-import Topics from '../components/Topics.astro'
77-import { throwPluginError } from '../lib/plugin'
88-import { getCurrentTopic, type Topic } from '../lib/sidebar'
99-1010-const { id, entry, sidebar } = Astro.props
1111-1212-let currentSidebar = sidebar
1313-let currentTopic: Topic | undefined = undefined
1414-1515-if (entry['data'].template !== 'splash') {
1616- currentTopic = getCurrentTopic(config, sidebar, id, entry)
1717- if (!currentTopic)
1818- throwPluginError(
1919- `Failed to find the topic for the \`${id}\` page.`,
2020- `Either include this page in the sidebar configuration of the desired topic using the \`items\` property or to associate an unlisted page with a topic, use the \`topic\` frontmatter property and set it to the desired topic ID.
2121-Learn more about unlisted pages in the ["Unlisted pages"](https://starlight-sidebar-topics.netlify.app/docs/guides/unlisted-pages/) guide.`,
2222- )
2323- currentSidebar = currentTopic.sidebar
2424-}
33+import StarlightSidebarTopicsDropdownSidebar from '../components/starlight/Sidebar.astro'
254---
2652727-{entry['data'].template !== 'splash' && currentTopic && <Topics current={currentTopic.config} />}
2828-<Default {...Astro.props} sidebar={currentSidebar}><slot /></Default>
2929-3030-{!currentTopic?.sidebarHasGroups &&
3131- <style is:global>
3232- sl-sidebar-state-persist summary {
3333- display: none !important;
3434- }
3535- sl-sidebar-state-persist ul li {
3636- margin-inline-start: 0;
3737- border-inline-start: none;
3838- }
3939- </style>
4040-}
66+<StarlightSidebarTopicsDropdownSidebar />
77+<Default><slot /></Default>
···33 /**
44 * ID of the topic to associate with the current page if the page is not listed in any topic sidebar configuration.
55 *
66- * @see https://starlight-sidebar-topics.netlify.app/docs/guides/unlisted-pages/
66+ * @see https://starlight-sidebar-topics-dropdown.trueberryless.org/docs/guides/unlisted-pages/
77 */
88 topic: z.string().optional(),
99});