From 34d7b421803658aebfc988a162063af4016ed4fa Mon Sep 17 00:00:00 2001 From: Nils Pukropp Date: Wed, 25 Mar 2026 16:02:35 +0100 Subject: [PATCH] VIM!!! --- backend/src/main.rs | 10 +++ frontend/src/pages/admin/editor.astro | 112 ++++++++++++++++++-------- frontend/src/pages/index.astro | 16 ++-- frontend/src/pages/posts/[slug].astro | 16 ++-- frontend/src/styles/global.css | 20 ++--- 5 files changed, 114 insertions(+), 60 deletions(-) diff --git a/backend/src/main.rs b/backend/src/main.rs index d5d272b..be59e9f 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -258,8 +258,18 @@ async fn list_posts(State(state): State>) -> impl IntoResponse { let path = entry.path(); if path.extension().and_then(|e| e.to_str()) == Some("md") { if let Some(slug) = path.file_stem().and_then(|s| s.to_str()) { + let mut excerpt = String::new(); + if let Ok(content) = fs::read_to_string(&path) { + // Strip basic markdown hashes and get first ~200 chars + let clean_content = content.replace("#", "").replace("\n", " "); + excerpt = clean_content.chars().take(200).collect::(); + if clean_content.len() > 200 { + excerpt.push_str("..."); + } + } posts.push(PostInfo { slug: slug.to_string(), + excerpt: excerpt.trim().to_string(), }); } } diff --git a/frontend/src/pages/admin/editor.astro b/frontend/src/pages/admin/editor.astro index ea2a6dc..b989e2c 100644 --- a/frontend/src/pages/admin/editor.astro +++ b/frontend/src/pages/admin/editor.astro @@ -3,6 +3,40 @@ import Layout from '../../layouts/Layout.astro'; --- + + + + + + + + +