From 867650fb7761b0cf94e9004df6c062d6bc603054 Mon Sep 17 00:00:00 2001 From: Aaron Powell Date: Wed, 11 Feb 2026 13:54:36 +1100 Subject: [PATCH] feat: add sticky sidebar navigation to learning hub articles --- website/public/styles/global.css | 78 +++++++++++++++++++++++++ website/src/layouts/ArticleLayout.astro | 68 ++++++++++++++++++++- 2 files changed, 143 insertions(+), 3 deletions(-) diff --git a/website/public/styles/global.css b/website/public/styles/global.css index 6bb9f8b8..aeb9955c 100644 --- a/website/public/styles/global.css +++ b/website/public/styles/global.css @@ -1594,6 +1594,84 @@ a:hover { color: var(--color-warning); } +/* Learning Hub - Sidebar Layout */ +.learning-hub-layout { + display: grid; + grid-template-columns: 240px 1fr; + gap: 48px; + align-items: start; +} + +.learning-hub-sidebar { + position: sticky; + top: 24px; + max-height: calc(100vh - 48px); + overflow-y: auto; +} + +.sidebar-section { + margin-bottom: 24px; +} + +.sidebar-section h3 { + font-size: 11px; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.08em; + color: var(--color-text-muted); + margin-bottom: 8px; + padding: 0 12px; +} + +.sidebar-nav-list { + list-style: none; + padding: 0; + margin: 0; +} + +.sidebar-nav-list li { + margin: 0; +} + +.sidebar-nav-list a { + display: block; + padding: 6px 12px; + font-size: 13px; + line-height: 1.4; + color: var(--color-text-muted); + text-decoration: none; + border-radius: 6px; + border-left: 2px solid transparent; + transition: color 0.15s, background-color 0.15s, border-color 0.15s; +} + +.sidebar-nav-list a:hover { + color: var(--color-text); + background-color: var(--color-glass); +} + +.sidebar-nav-list a.active { + color: var(--color-text-emphasis); + background-color: var(--color-glass); + border-left-color: var(--color-accent); + font-weight: 600; +} + +@media (max-width: 900px) { + .learning-hub-layout { + grid-template-columns: 1fr; + gap: 0; + } + + .learning-hub-sidebar { + position: static; + max-height: none; + border-bottom: 1px solid var(--color-border); + padding-bottom: 20px; + margin-bottom: 32px; + } +} + /* Learning Hub - Article Styles */ .breadcrumb { margin-bottom: 16px; diff --git a/website/src/layouts/ArticleLayout.astro b/website/src/layouts/ArticleLayout.astro index e0396536..9893402f 100644 --- a/website/src/layouts/ArticleLayout.astro +++ b/website/src/layouts/ArticleLayout.astro @@ -1,5 +1,6 @@ --- import BaseLayout from './BaseLayout.astro'; +import { getCollection } from 'astro:content'; interface Props { title: string; @@ -11,6 +12,31 @@ interface Props { const { title, description, estimatedReadingTime, lastUpdated, tags } = Astro.props; const base = import.meta.env.BASE_URL; + +const articles = await getCollection('learning-hub'); + +const fundamentalsOrder = [ + 'what-are-agents-prompts-instructions', + 'understanding-copilot-context', + 'copilot-configuration-basics', + 'defining-custom-instructions', + 'creating-effective-prompts', + 'before-after-customization-examples', +]; + +const referenceOrder = [ + 'github-copilot-terminology-glossary', +]; + +const fundamentals = articles + .filter((a) => fundamentalsOrder.includes(a.id)) + .sort((a, b) => fundamentalsOrder.indexOf(a.id) - fundamentalsOrder.indexOf(b.id)); + +const reference = articles + .filter((a) => referenceOrder.includes(a.id)) + .sort((a, b) => referenceOrder.indexOf(a.id) - referenceOrder.indexOf(b.id)); + +const currentSlug = Astro.url.pathname.replace(/\/$/, '').split('/').pop(); --- @@ -38,9 +64,45 @@ const base = import.meta.env.BASE_URL;
-
- -
+
+ +
+ +
+