the runtime your coding agents live on
Rust agentagent-orchestrationaiai-agentsclaude-codeclicodexcoding-agentsdeveloper-toolsdevtoolsmultiplexerrustterminalterminal-multiplexerterminal-uitmuxtuiworkspace-manager
fix: preserve preview docs navigation
Ogulcan Celikbe69ef9eeb8f
diff --git a/src/update.rs b/src/update.rsindex 58095c08f..0d73b5b11 100644--- a/src/update.rs+++ b/src/update.rs@@ -3000,8 +3000,10 @@ mod tests {#[test]fn preview_manifest_reports_update_when_build_id_differs() {- let manifest: PreviewManifest = serde_json::from_str(- r####"{+ let (os, arch) = platform_target();+ let asset_key = format!("{os}-{arch}");+ let json = format!(+ r####"{{"channel": "preview","base_version": "9.9.9","build_id": "2026-06-02-abcdef123456",@@ -3009,29 +3011,29 @@ mod tests {"built_at": "2026-06-02T03:00:00Z","protocol": 77,"notes": "### Fixed\n- One",- "assets": {- "linux-x86_64": {+ "assets": {{+ "{asset_key}": {{"url": "https://example.com/herdr-linux-x86_64","sha256": "deadbeef"- }- },- "builds": {- "2026-06-02-abcdef123456": {+ }}+ }},+ "builds": {{+ "2026-06-02-abcdef123456": {{"base_version": "9.9.9","commit": "abcdef1234567890","built_at": "2026-06-02T03:00:00Z","protocol": 77,- "assets": {- "linux_x86_64": {+ "assets": {{+ "{asset_key}": {{"url": "https://example.com/herdr-linux_x86_64","sha256": "deadbeef"- }- }- }- }- }"####,- )- .unwrap();+ }}+ }}+ }}+ }}+ }}"####+ );+ let manifest: PreviewManifest = serde_json::from_str(&json).unwrap();let release = release_info_from_preview_manifest(&manifest).unwrap()diff --git a/website/astro.config.mjs b/website/astro.config.mjsindex 2da2dd447..00d97ccc0 100644--- a/website/astro.config.mjs+++ b/website/astro.config.mjs@@ -63,6 +63,7 @@ export default defineConfig({],components: {Header: './src/components/Header.astro',+ Sidebar: './src/components/Sidebar.astro',SiteTitle: './src/components/SiteTitle.astro',},customCss: ['./src/styles/starlight.css'],diff --git a/website/src/components/Sidebar.astro b/website/src/components/Sidebar.astronew file mode 100644index 000000000..c875a3907--- /dev/null+++ b/website/src/components/Sidebar.astro@@ -0,0 +1,49 @@+---+import MobileMenuFooter from 'virtual:starlight/components/MobileMenuFooter';+import SidebarPersister from '@astrojs/starlight/components/SidebarPersister.astro';+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;++function rewriteSidebar(entries) {+ return entries.map((entry) => {+ if (entry.type === 'link') {+ const href = previewHref(entry.href);+ return {+ ...entry,+ href,+ isCurrent: samePath(href, pathname),+ };+ }+ const rewrittenEntries = rewriteSidebar(entry.entries);+ return {+ ...entry,+ entries: rewrittenEntries,+ };+ });+}++function previewHref(href) {+ if (!href.startsWith('/docs/') || href.startsWith('/docs/preview/')) return href;+ return href === '/docs/' ? '/docs/preview/' : href.replace(/^\/docs\//, '/docs/preview/');+}++function samePath(left, right) {+ return stripTrailingSlash(left) === stripTrailingSlash(right);+}++function stripTrailingSlash(path) {+ return path.length > 1 ? path.replace(/\/$/, '') : path;+}+---++<SidebarPersister>+ <SidebarSublist sublist={channelSidebar} />+</SidebarPersister>++<div class="md:sl-hidden">+ <MobileMenuFooter />+</div>diff --git a/website/src/components/SiteTitle.astro b/website/src/components/SiteTitle.astroindex 1173f2b6d..d35da5d6b 100644--- a/website/src/components/SiteTitle.astro+++ b/website/src/components/SiteTitle.astro@@ -1,5 +1,7 @@---const { siteTitle, siteTitleHref } = Astro.locals.starlightRoute;+const isPreview = Astro.url.pathname === '/docs/preview/' || Astro.url.pathname.startsWith('/docs/preview/');+const docsHref = isPreview ? '/docs/preview/' : '/docs/';---<div class="title-row sl-flex">@@ -8,7 +10,7 @@ const { siteTitle, siteTitleHref } = Astro.locals.starlightRoute;<span translate="no">{siteTitle}</span></a><nav class="title-nav" aria-label="Primary">- <a href="/docs/">Docs</a>+ <a href={docsHref}>Docs</a><a href="/releases/">Releases</a><a href="/blog/">Blog</a></nav>