mirror of
https://github.com/github/awesome-copilot.git
synced 2026-03-14 05:05:15 +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:
20
website/src/config/learning-hub.ts
Normal file
20
website/src/config/learning-hub.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
// Shared article ordering for the Learning Hub.
|
||||||
|
// Used by both the index page and the article sidebar layout.
|
||||||
|
|
||||||
|
export 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',
|
||||||
|
];
|
||||||
|
|
||||||
|
export const referenceOrder = [
|
||||||
|
'github-copilot-terminology-glossary',
|
||||||
|
];
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
import BaseLayout from './BaseLayout.astro';
|
import BaseLayout from './BaseLayout.astro';
|
||||||
import { getCollection } from 'astro:content';
|
import { getCollection } from 'astro:content';
|
||||||
|
import { fundamentalsOrder, referenceOrder } from '../config/learning-hub';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
@@ -15,24 +16,6 @@ const base = import.meta.env.BASE_URL;
|
|||||||
|
|
||||||
const articles = await getCollection('learning-hub');
|
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
|
const fundamentals = articles
|
||||||
.filter((a) => fundamentalsOrder.includes(a.id))
|
.filter((a) => fundamentalsOrder.includes(a.id))
|
||||||
.sort((a, b) => fundamentalsOrder.indexOf(a.id) - fundamentalsOrder.indexOf(b.id));
|
.sort((a, b) => fundamentalsOrder.indexOf(a.id) - fundamentalsOrder.indexOf(b.id));
|
||||||
|
|||||||
@@ -1,28 +1,11 @@
|
|||||||
---
|
---
|
||||||
import BaseLayout from '../../layouts/BaseLayout.astro';
|
import BaseLayout from '../../layouts/BaseLayout.astro';
|
||||||
import { getCollection } from 'astro:content';
|
import { getCollection } from 'astro:content';
|
||||||
|
import { fundamentalsOrder, referenceOrder } from '../../config/learning-hub';
|
||||||
|
|
||||||
const base = import.meta.env.BASE_URL;
|
const base = import.meta.env.BASE_URL;
|
||||||
const articles = await getCollection('learning-hub');
|
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
|
const fundamentals = articles
|
||||||
.filter((a) => fundamentalsOrder.includes(a.id))
|
.filter((a) => fundamentalsOrder.includes(a.id))
|
||||||
.sort((a, b) => fundamentalsOrder.indexOf(a.id) - fundamentalsOrder.indexOf(b.id));
|
.sort((a, b) => fundamentalsOrder.indexOf(a.id) - fundamentalsOrder.indexOf(b.id));
|
||||||
|
|||||||
Reference in New Issue
Block a user