From e48605241347bbcbddb846a5f76bf82167e197c5 Mon Sep 17 00:00:00 2001 From: YouHaveTrouble Date: Mon, 22 Sep 2025 19:16:56 +0200 Subject: [PATCH] display latest blog post title and mess with transitions --- src/pages/blog/[slug].astro | 5 ++ src/pages/index.astro | 118 +++++++++++++++++++++++++++++++++--- 2 files changed, 113 insertions(+), 10 deletions(-) diff --git a/src/pages/blog/[slug].astro b/src/pages/blog/[slug].astro index 9bae9fa..c431355 100644 --- a/src/pages/blog/[slug].astro +++ b/src/pages/blog/[slug].astro @@ -53,6 +53,11 @@ const permalink = `${Astro?.site?.href}blog/${slug}`; header h1 { margin-bottom: 0.7em; + display: flex; + justify-content: center; + view-transition-name: blog-title; + width: fit-content; + margin-inline: auto; } header p { diff --git a/src/pages/index.astro b/src/pages/index.astro index fbf08d6..eccb73c 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -4,10 +4,17 @@ import ActivityWidget from "../components/ActivityWidget.astro"; import ViewCounter from "../components/ViewCounter.astro"; import SocialsWidget from "../components/SocialsWidget.astro"; import ProjectsFeature from "../components/ProjectsFeature.astro"; +import {getCollection} from "astro:content"; const title = 'Home'; const description = 'My little corner of the internet.'; const permalink = Astro?.site?.href ?? '/'; + +const latestBlogPost = await getCollection("posts") + .then(posts => posts.sort( + (a, b) => new Date(b.data.publishDate).getTime() - new Date(a.data.publishDate).getTime() + ) + ).then(sortedBlogPosts => sortedBlogPosts.length > 0 ? sortedBlogPosts[0] : null); --- @@ -19,20 +26,62 @@ const permalink = Astro?.site?.href ?? '/';
-
- +
+
- +
- +
- I have a blog btw! - It also has an RSS feed! + Latest article: + { + latestBlogPost === null ? ( +
+ No articles yet + Come back later to check for new articles! +
+ ) : null + } +
+ {latestBlogPost?.data.title} + {latestBlogPost?.data.description} +
+
+ { + latestBlogPost !== null && ( + Read more + All articles + ) + } +
+
@@ -44,7 +93,8 @@ const permalink = Astro?.site?.href ?? '/';
-
@@ -52,15 +102,17 @@ const permalink = Astro?.site?.href ?? '/';

Here are some of the projects I'm working on. Most of them are open source, so feel free to check them out!
- Projects presented here are what I consider in presentable and/or finished state. They might or might not get + Projects presented here are what I consider in presentable and/or finished state. They might or might not + get updates.
- Most logos generated using DALL-E mini. + Most logos generated using DALL-E + mini.
Inviter logo by SlyFox

- +
@@ -112,6 +164,52 @@ const permalink = Astro?.site?.href ?? '/'; width: 100%; gap: 0.5rem; flex: 1; + + .latest-article { + display: flex; + flex-direction: column; + align-items: center; + text-align: center; + margin-bottom: 0.5rem; + background: rgba(255,255,255, 0.05); + padding: 0.5rem; + border-radius: 0.25rem; + + .title { + font-weight: 600; + font-size: 1.1rem; + view-transition-name: blog-title; + } + + .excerpt { + font-size: 0.9rem; + color: var(--text-secondary); + } + } + + .actions { + display: flex; + gap: 0.5rem; + } + + } + + .buttons { + .rss { + display: flex; + height: 100%; + justify-content: center; + align-items: center; + aspect-ratio: 1/1; + padding-bottom: 4px; + a { + height: 100%; + width: 100%; + display: flex; + justify-content: center; + align-items: center; + } + } } .window-row {