--- import BaseLayout from './BaseLayout.astro'; import { getCollection } from 'astro:content'; import { fundamentalsOrder, referenceOrder } from '../config/learning-hub'; interface Props { title: string; description?: string; estimatedReadingTime?: string; lastUpdated?: string; tags?: string[]; } const { title, description, estimatedReadingTime, lastUpdated, tags } = Astro.props; const base = import.meta.env.BASE_URL; const createOrderIndexMap = (order: string[]) => { const map = new Map(); for (let i = 0; i < order.length; i += 1) { map.set(order[i], i); } return map; }; const articles = await getCollection('learning-hub'); const fundamentalsOrderIndex = createOrderIndexMap(fundamentalsOrder); const referenceOrderIndex = createOrderIndexMap(referenceOrder); const fundamentals = articles .filter((a) => fundamentalsOrderIndex.has(a.id)) .sort( (a, b) => (fundamentalsOrderIndex.get(a.id) ?? 0) - (fundamentalsOrderIndex.get(b.id) ?? 0), ); const reference = articles .filter((a) => referenceOrderIndex.has(a.id)) .sort( (a, b) => (referenceOrderIndex.get(a.id) ?? 0) - (referenceOrderIndex.get(b.id) ?? 0), ); const currentSlug = Astro.url.pathname.replace(/\/$/, '').split('/').pop(); ---