From 456cf011b36de91c9936994b1fa45703adcd309b Mon Sep 17 00:00:00 2001 From: Dawid Rycerz Date: Thu, 3 Jul 2025 10:56:21 +0300 Subject: Initial fork of chrismwilliams/astro-theme-cactus theme --- src/pages/index.astro | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/pages/index.astro (limited to 'src/pages/index.astro') diff --git a/src/pages/index.astro b/src/pages/index.astro new file mode 100644 index 0000000..d953797 --- /dev/null +++ b/src/pages/index.astro @@ -0,0 +1,61 @@ +--- +import { type CollectionEntry, getCollection } from "astro:content"; +import SocialList from "@/components/SocialList.astro"; +import PostPreview from "@/components/blog/PostPreview.astro"; +import Note from "@/components/note/Note.astro"; +import { getAllPosts } from "@/data/post"; +import PageLayout from "@/layouts/Base.astro"; +import { collectionDateSort } from "@/utils/date"; + +// Posts +const MAX_POSTS = 10; +const allPosts = await getAllPosts(); +const allPostsByDate = allPosts + .sort(collectionDateSort) + .slice(0, MAX_POSTS) as CollectionEntry<"post">[]; + +// Notes +const MAX_NOTES = 5; +const allNotes = await getCollection("note"); +const latestNotes = allNotes.sort(collectionDateSort).slice(0, MAX_NOTES); +--- + + +
+

Hello World!

+

+ Hi, I’m a theme for Astro, a simple starter that you can use to create your website or blog. + If you want to know more about how you can customise me, add more posts, and make it your own, + click on the GitHub icon link below and it will take you to my repo. +

+ +
+
+

Posts

+
    + { + allPostsByDate.map((p) => ( +
  • + +
  • + )) + } +
+
+ { + latestNotes.length > 0 && ( +
+

+ Notes +

+
    + {latestNotes.map((note) => ( +
  • + +
  • + ))} +
+
+ ) + } +
-- cgit v1.2.3