From 12a6bdeae2c956dd5efa127dca7a52e9829df99f Mon Sep 17 00:00:00 2001 From: thiloho <123883702+thiloho@users.noreply.github.com> Date: Sun, 21 Sep 2025 00:11:18 +0200 Subject: [PATCH] Highlight search terms for blog articles --- src/pages/blog/index.astro | 79 ++++++++++++++++++++++++++++++-------- src/styles/global.css | 4 ++ 2 files changed, 67 insertions(+), 16 deletions(-) diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index e95828a..fae86df 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -2,7 +2,6 @@ import PageLayout from "../../layouts/PageLayout.astro"; import { getCollection } from "astro:content"; import Date from "../../components/Date.astro"; - const allArticles = await getCollection("blog"); const sortedArticles = allArticles.sort((a, b) => { return b.data.pubDate.valueOf() - a.data.pubDate.valueOf(); @@ -33,9 +32,11 @@ const sortedArticles = allArticles.sort((a, b) => { class="max-w-fit text-blue-800 hover:no-underline active:bg-neutral-200 active:dark:bg-neutral-700" href={`/blog/${id}`} > - {title} + {title} -
{description}
++ {description} +
)) } @@ -43,44 +44,90 @@ const sortedArticles = allArticles.sort((a, b) => { No articles found matching your search. -