diff --git a/src/pages/learning-paths.astro b/src/pages/learning-paths.astro index 0c2800cdb52e04c..07dbbd8c6a7b739 100644 --- a/src/pages/learning-paths.astro +++ b/src/pages/learning-paths.astro @@ -1,6 +1,6 @@ --- import StarlightPage from "@astrojs/starlight/components/StarlightPage.astro"; -import { getCollection } from "astro:content"; +import { getCollection, type CollectionEntry } from "astro:content"; import { marked } from "marked"; import { CardGrid, LinkTitleCard, Description } from "~/components"; @@ -12,21 +12,201 @@ const frontmatter = { } as const; const learningPaths = await getCollection("learning-paths"); + +function lpGroups(paths: Array>) { + const groups = paths.flatMap((p) => p.data.product_group ?? []); + const additional = paths.flatMap((p) => p.data.additional_groups ?? []); + + const unique = [...new Set(groups.concat(additional))]; + + return unique.sort(); +} + +function lpProducts(paths: Array>) { + const products = paths.flatMap((p) => p.data.products ?? []); + + const unique = [...new Set(products)]; + + return unique.sort(); +} + +const groups = lpGroups(learningPaths); +const products = lpProducts(learningPaths); --- {frontmatter.description} - - { - learningPaths.map((lp) => ( - - )) - } - +
+ +
+ + { + learningPaths + .sort((a, b) => a.data.priority - b.data.priority) + .map((lp) => ( +
+ +
+ )) + } +
+
+
+ +