diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-07 19:55:44 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-07 19:55:44 +0300 |
| commit | 970c07ea3110f114f6cb348ccbef5a6f763373ce (patch) | |
| tree | 071cc22b4e26be964e51dda280d3dcb4f74b5fc9 /website/src/components/Sidebar.astro | |
| parent | c01b947d0bde1663980a15727938ac666ce31f61 (diff) | |
docs: document windows preview installs
Diffstat (limited to 'website/src/components/Sidebar.astro')
| -rw-r--r-- | website/src/components/Sidebar.astro | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/website/src/components/Sidebar.astro b/website/src/components/Sidebar.astro index c875a390..8ded83bb 100644 --- a/website/src/components/Sidebar.astro +++ b/website/src/components/Sidebar.astro @@ -6,7 +6,34 @@ import SidebarSublist from '@astrojs/starlight/components/SidebarSublist.astro'; const { sidebar } = Astro.locals.starlightRoute; const pathname = Astro.url.pathname; const isPreview = pathname === '/docs/preview/' || pathname.startsWith('/docs/preview/'); -const channelSidebar = isPreview ? rewriteSidebar(sidebar) : sidebar; +const channelSidebar = isPreview ? addPreviewOnlyItems(rewriteSidebar(sidebar)) : sidebar; + +function addPreviewOnlyItems(entries) { + return entries.map((entry) => { + if (entry.type !== 'group' || entry.label !== 'Start here') return entry; + + const windowsBeta = { + type: 'link', + label: 'Windows beta', + href: '/docs/preview/windows-beta/', + badge: undefined, + isCurrent: samePath('/docs/preview/windows-beta/', pathname), + attrs: {}, + }; + const nextEntries = []; + for (const child of entry.entries) { + nextEntries.push(child); + if (child.type === 'link' && child.label === 'Install') { + nextEntries.push(windowsBeta); + } + } + + return { + ...entry, + entries: nextEntries, + }; + }); +} function rewriteSidebar(entries) { return entries.map((entry) => { |
