mirror of
https://github.com/github/awesome-copilot.git
synced 2026-03-13 20:55:13 +00:00
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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user