From 89fd09fc0e7e3245d7694bf21ee6818f951d95f6 Mon Sep 17 00:00:00 2001 From: "Sean (ANGRYxScotsman)" <36518683+seanh1995@users.noreply.github.com> Date: Mon, 3 Aug 2026 17:36:46 +0100 Subject: [PATCH] fix(docs): add mobile navigation to the splash homepage (#4904) The homepage uses Starlight's splash template, which has no sidebar and therefore never gets Starlight's own mobile menu toggle - on narrow viewports there was no way to reach any nav link at all. Add a small toggle + panel in the header (only rendered on pages without a sidebar) exposing the same links as the desktop nav, and group it with the search icon so mobile actions sit together instead of spread across the header. Also add the Store and Forums links to the real sidebar config so they're reachable on mobile on every other page too (previously only in the desktop-only top nav), and pull both URLs from a shared site-links.ts so the sidebar config and header can't drift apart. --- docs/astro.config.mjs | 3 + docs/src/components/Header.astro | 144 +++++++++++++++++++++++++++++-- docs/src/site-links.ts | 5 ++ 3 files changed, 147 insertions(+), 5 deletions(-) create mode 100644 docs/src/site-links.ts diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 88b8b0bb..e4116184 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -1,6 +1,7 @@ // @ts-check import { defineConfig } from 'astro/config'; import starlight from '@astrojs/starlight'; +import { siteLinks } from './src/site-links.ts'; // https://astro.build/config export default defineConfig({ @@ -59,8 +60,10 @@ export default defineConfig({ { label: 'FAQ', slug: 'faq' }, { label: 'Known Issues', slug: 'knownissues' }, { label: 'Contributing', slug: 'contributing' }, + { label: siteLinks.forums.label, link: siteLinks.forums.href, attrs: { target: '_blank', rel: 'noreferrer' } }, ], }, + { label: siteLinks.store.label, link: siteLinks.store.href, attrs: { target: '_blank', rel: 'noreferrer' } }, ], }), ], diff --git a/docs/src/components/Header.astro b/docs/src/components/Header.astro index 9a5007b8..faf02ea0 100644 --- a/docs/src/components/Header.astro +++ b/docs/src/components/Header.astro @@ -6,10 +6,15 @@ import Search from 'virtual:starlight/components/Search'; import SiteTitle from 'virtual:starlight/components/SiteTitle'; import SocialIcons from 'virtual:starlight/components/SocialIcons'; import ThemeSelect from 'virtual:starlight/components/ThemeSelect'; +import { Icon } from '@astrojs/starlight/components'; +import { siteLinks } from '../site-links'; // Render the `Search` component if Pagefind is enabled or the default search component has been overridden. const shouldRenderSearch = config.pagefind || config.components.Search !== '@astrojs/starlight/components/Search.astro'; + +// Pages with a sidebar already have Starlight's own mobile menu toggle; only splash pages need this one. +const { hasSidebar } = Astro.locals.starlightRoute; ---
@@ -17,9 +22,36 @@ const shouldRenderSearch =
- {/* Search box. */} -
- {shouldRenderSearch && } +
+ {/* Search box. */} +
+ {shouldRenderSearch && } +
+ { + !hasSidebar && ( + + ) + }
{/* Right-side group: nav links, social icons, theme/language pickers. */}
@@ -43,10 +75,10 @@ const shouldRenderSearch =
- Store + {siteLinks.store.label}
+ + diff --git a/docs/src/site-links.ts b/docs/src/site-links.ts new file mode 100644 index 00000000..dc2f31aa --- /dev/null +++ b/docs/src/site-links.ts @@ -0,0 +1,5 @@ +// Shared external links, so astro.config.mjs and Header.astro can't drift out of sync. +export const siteLinks = { + store: { label: 'Store', href: 'https://christitus.com/downloads/' }, + forums: { label: 'Forums', href: 'https://forum.christitus.com/' }, +} as const;