From 32ea6b68e3817a652f24e1a8a093822facd6c5ca Mon Sep 17 00:00:00 2001 From: SoldierPePe Date: Sat, 7 Nov 2026 09:11:34 +0300 Subject: [PATCH] Group the sidebar's apps by the home page's categories (#8) * Group the sidebar's apps by the home page's categories * Keep the Official apps heading over the categories The categories become smaller sub-headings under OFFICIAL APPS, the way the home page nests them under The Craft Apps, so the sidebar still tells the official apps from the third-party ones. --- README.md | 4 ++-- src/components/WikiSidebar.astro | 24 ++++++++++++++++-------- src/data/apps.mjs | 14 ++++++++++++++ src/styles/custom.css | 2 ++ 4 files changed, 34 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index c6e78b5..6a770c1 100644 --- a/README.md +++ b/README.md @@ -84,9 +84,9 @@ Starlight uses the `docsLoader()` and `docsSchema()` in `src/content.config.ts` The navigation and home page have a small amount of explicit configuration. To add an app: 1. Create its Markdown pages under `src/content/docs/apps//` and add its icon to `public/assets/apps/`. -2. Add its slug, display name, and any non-default icon extension to `src/data/apps.mjs`. `WikiSidebar.astro` uses this list to render the icon and expandable group. +2. Add its slug, display name, and any non-default icon extension to `src/data/apps.mjs`, and add an official app's slug to its category in `appCategories` there. `WikiSidebar.astro` uses these lists to render the icon and expandable group under its category; the build stops if an official app has no category. 3. Add a matching app group in `astro.config.mjs` and a collection in `public/admin/config.yml` so Starlight and Sveltia can find its pages. -4. Add an icon card to `src/content/docs/index.mdx` and update its app count. +4. Add an icon card to the same category in `src/content/docs/index.mdx` and update its app count. 5. Run `npm run build` and check the home page, app links, and `/admin/`. The custom sidebar uses the `guides` list in `src/data/apps.mjs` for its links. If guide filenames or the set of guides change, update that list too. Pages an app has beyond the five shared guides, such as WordCraft's Zotero page, go in `extraGuides` under the app's slug; the sidebar lists them before Troubleshooting. Give them `sidebar.order` in their frontmatter too, so the previous and next links follow the same order. Pages that the sidebar nests under one guide, such as VectorCraft's task guides under Workflows, go in `childGuides` under the app's slug and then the guide's slug. The sidebar lists them under that guide's link and expands the list on the guide and on each of its pages. Give them `sidebar.order` values between the guide's and the next page's, so the previous and next links visit them right after the guide. Starlight's autogenerated sidebar configuration does not by itself add links to the custom sidebar. diff --git a/src/components/WikiSidebar.astro b/src/components/WikiSidebar.astro index 14f16a3..4e4fd38 100644 --- a/src/components/WikiSidebar.astro +++ b/src/components/WikiSidebar.astro @@ -1,19 +1,27 @@ --- -import { apps, thirdPartyApps } from '../data/apps.mjs'; +import { apps, appCategories, thirdPartyApps } from '../data/apps.mjs'; import WikiGuideLinks from './WikiGuideLinks.astro'; const pathname = Astro.url.pathname; +const appBySlug = Object.fromEntries(apps.map((app) => [app[0], app])); ---
All documentation

OFFICIAL APPS

-
- {apps.map(([slug, name, ext = 'webp']) => ( -
- {name} - -
+
+ {appCategories.map(([category, slugs]) => ( + <> +

{category}

+
+ {slugs.map((slug) => appBySlug[slug]).map(([slug, name, ext = 'webp']) => ( +
+ {name} + +
+ ))} +
+ ))}

THIRD-PARTY APPS

@@ -30,7 +38,7 @@ const pathname = Astro.url.pathname;