refactor: extract Learning Hub article ordering into shared config

Move duplicated fundamentalsOrder and referenceOrder arrays from
index.astro and ArticleLayout.astro into a shared config file at
src/config/learning-hub.ts. Both consumers now import from the
single source of truth.

Addresses PR review comment about maintenance burden of keeping
two copies in sync.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Aaron Powell
2026-02-26 14:59:50 +11:00
parent e0636e8165
commit 0637cad186
3 changed files with 22 additions and 36 deletions

View File

@@ -1,6 +1,7 @@
---
import BaseLayout from './BaseLayout.astro';
import { getCollection } from 'astro:content';
import { fundamentalsOrder, referenceOrder } from '../config/learning-hub';
interface Props {
title: string;
@@ -15,24 +16,6 @@ const base = import.meta.env.BASE_URL;
const articles = await getCollection('learning-hub');
const fundamentalsOrder = [
'what-are-agents-skills-instructions',
'understanding-copilot-context',
'copilot-configuration-basics',
'defining-custom-instructions',
'creating-effective-skills',
'building-custom-agents',
'understanding-mcp-servers',
'automating-with-hooks',
'using-copilot-coding-agent',
'installing-and-using-plugins',
'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));