From 9fe4480c3981c38ae8e24d0495df957039864a5d Mon Sep 17 00:00:00 2001 From: Dawid Rycerz Date: Tue, 13 Jan 2026 17:13:43 +0100 Subject: Remove micro and migrate to use only posts --- src/pages/index.astro | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'src/pages/index.astro') diff --git a/src/pages/index.astro b/src/pages/index.astro index 1bc088c..e3884ef 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,23 +1,27 @@ --- -import { type CollectionEntry, getCollection } from "astro:content"; +import type { CollectionEntry } from "astro:content"; import PostPreview from "@/components/blog/PostPreview.astro"; -import Note from "@/components/note/Note.astro"; import SocialList from "@/components/SocialList.astro"; import { getAllPosts } from "@/data/post"; import PageLayout from "@/layouts/Base.astro"; import { collectionDateSort } from "@/utils/date"; -// Posts -const MAX_POSTS = 10; +// Get all posts const allPosts = await getAllPosts(); -const allPostsByDate = allPosts + +// Posts section - exclude archived and microblog +const MAX_POSTS = 10; +const regularPosts = allPosts.filter( + (post) => !post.data.tags.includes("archived") && !post.data.tags.includes("microblog"), +); +const allPostsByDate = regularPosts .sort(collectionDateSort) .slice(0, MAX_POSTS) as CollectionEntry<"post">[]; -// Micro -const MAX_MICRO = 5; -const allMicro = await getCollection("micro").catch(() => []); // Fallback to empty array if micro collection fails -const latestMicro = allMicro.sort(collectionDateSort).slice(0, MAX_MICRO); +// Microblog posts section - only posts with microblog tag +const MAX_MICROBLOG = 5; +const allMicroblogPosts = allPosts.filter((post) => post.data.tags.includes("microblog")); +const latestMicroblog = allMicroblogPosts.sort(collectionDateSort).slice(0, MAX_MICROBLOG); --- @@ -46,15 +50,15 @@ const latestMicro = allMicro.sort(collectionDateSort).slice(0, MAX_MICRO); { - latestMicro.length > 0 && ( + latestMicroblog.length > 0 && (

- Micro + Microblog

    - {latestMicro.map((note) => ( -
  • - + {latestMicroblog.map((post) => ( +
  • +
  • ))}
-- cgit v1.2.3