Mirror of
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

small fixes and docs changes

+26 -29
+5
.changeset/tall-meals-cross.md
··· 1 + --- 2 + "starlight-sidebar-topics-dropdown": patch 3 + --- 4 + 5 + Small fixes and docs changes
+18
docs/src/content/docs/docs/getting-started.mdx
··· 83 83 </Steps> 84 84 85 85 The Starlight Sidebar Topics Dropdown plugin behavior can be tweaked using various [topic configuration options](/docs/configuration/#topic-configuration). 86 + 87 + ## Component overrides 88 + 89 + The Starlight Sidebar Topics Dropdown plugin uses a Starlight [component override](https://starlight.astro.build/guides/overriding-components/) for the [`Sidebar`](https://starlight.astro.build/reference/overrides/#sidebar) component to add the dropdown which enables choosing between different topics. 90 + 91 + If you have a custom `Sidebar` component override in your Starlight project, you will need to manually render the `Sidebar` component from the Starlight Sidebar Topics Dropdown plugin in your custom component: 92 + 93 + ```diff lang="astro" 94 + --- 95 + // src/components/overrides/Sidebar.astro 96 + import Default from '@astrojs/starlight/components/Sidebar.astro' 97 + +import StarlightSidebarTopicsDropdownSidebar from 'starlight-sidebar-topics-dropdown/components/Sidebar.astro' 98 + --- 99 + 100 + +<StarlightSidebarTopicsDropdownSidebar /> 101 + <p>Custom content in the Sidebar override</p> 102 + <Default><slot /></Default> 103 + ```
+3 -1
packages/starlight-sidebar-topics-dropdown/index.ts
··· 7 7 StarlightSidebarTopicsDropdownConfigSchema, 8 8 type StarlightSidebarTopicsDropdownUserConfig, 9 9 } from "./libs/config"; 10 - import { overrideStarlightComponent, throwPluginError } from "./libs/plugin"; 10 + import { throwPluginError } from "./libs/plugin"; 11 11 import { vitePluginStarlightSidebarTopicsDropdown } from "./libs/vite"; 12 + import { overrideStarlightComponent } from "./libs/starlight"; 12 13 13 14 export type { 14 15 StarlightSidebarTopicsDropdownConfig, ··· 68 69 ...overrideStarlightComponent( 69 70 starlightConfig.components, 70 71 logger, 72 + "Sidebar", 71 73 "Sidebar" 72 74 ), 73 75 },
-23
packages/starlight-sidebar-topics-dropdown/libs/plugin.ts
··· 1 - import type { StarlightUserConfig } from "@astrojs/starlight/types"; 2 - import type { AstroIntegrationLogger } from "astro"; 3 1 import { AstroError } from "astro/errors"; 4 2 5 3 export function throwPluginError(message: string, hint?: string): never { ··· 9 7 `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` 10 8 ); 11 9 } 12 - 13 - export function overrideStarlightComponent( 14 - components: StarlightUserConfig["components"], 15 - logger: AstroIntegrationLogger, 16 - component: keyof NonNullable<StarlightUserConfig["components"]> 17 - ) { 18 - if (components?.[component]) { 19 - logger.warn( 20 - `It looks like you already have a \`${component}\` component override in your Starlight configuration.` 21 - ); 22 - logger.warn( 23 - `To use \`starlight-sidebar-topics-dropdown\`, either remove your override or update it to render the content from \`starlight-sidebar-topics-dropdown/overrides/${component}.astro\`.` 24 - ); 25 - 26 - return {}; 27 - } 28 - 29 - return { 30 - [component]: `starlight-sidebar-topics-dropdown/overrides/${component}.astro`, 31 - }; 32 - }
-5
packages/starlight-sidebar-topics-dropdown/libs/starlight.ts
··· 14 14 logger.warn( 15 15 `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\`.` 16 16 ); 17 - // if (component === "DynamicVersionBadge") { 18 - // logger.warn( 19 - // "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." 20 - // ); 21 - // } 22 17 23 18 return {}; 24 19 }