starlight-sidebar-topics
Version:
Starlight plugin to split your documentation into different sections, each with its own sidebar.
15 lines (11 loc) • 545 B
text/typescript
import type { StarlightRouteData } from '@astrojs/starlight/route-data'
import type { TopicFrontmatterSchema } from '../schema'
export function isStarlightEntryWithTopic(entry: StarlightEntry): entry is StarlightEntryWithTopic {
return (
'data' in entry &&
'topic' in (entry as StarlightEntryWithTopic).data &&
typeof (entry as StarlightEntryWithTopic).data.topic === 'string'
)
}
export type StarlightEntry = StarlightRouteData['entry']
export type StarlightEntryWithTopic = StarlightEntry & { data: TopicFrontmatterSchema }