g1t/apps/docs/src/route-data.ts

10 lines415 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Docs in the shape of docs.continue.dev1import { defineRouteMiddleware } from '@astrojs/starlight/route-data';
2
3import { tabFor } from './tabs';
4
5/** Each page's sidebar holds only its tab's groups. */
6export const onRequest = defineRouteMiddleware((context) => {
7 const route = context.locals.starlightRoute;
8 const tab = tabFor(route.id);
9 route.sidebar = route.sidebar.filter((entry) => entry.type === 'group' && tab.groups.includes(entry.label));
10});