From 9f1d2ec5db2925eecba278eaed32f673f9ceeb57 Mon Sep 17 00:00:00 2001 From: Thomas Hodges Date: Thu, 6 Aug 2026 13:42:07 -0500 Subject: [PATCH] Sort CRE templates by publish date Render newly published templates first on the CRE templates hub. --- src/pages/cre-templates/index.astro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/cre-templates/index.astro b/src/pages/cre-templates/index.astro index 3f3f47dbf29..085f5f70795 100644 --- a/src/pages/cre-templates/index.astro +++ b/src/pages/cre-templates/index.astro @@ -3,7 +3,9 @@ import { getCollection } from "astro:content" import BaseLayout from "~/layouts/BaseLayout.astro" import TemplateCard from "~/components/CRETemplate/TemplateCard.astro" -const templates = await getCollection("cre-templates") +const templates = (await getCollection("cre-templates")).sort( + (a, b) => (b.data.datePublished ?? "").localeCompare(a.data.datePublished ?? "") +) const featuredTemplate = templates.find((t) => t.data.featured) const pageTitle = "CRE Templates Hub | Chainlink Documentation"