content collections for badges and projects

This commit is contained in:
Reid 2024-09-18 17:13:15 -07:00
parent b09fe1b8bf
commit 49562a82a4
Signed by: reidlab
GPG key ID: DAF5EAF6665839FD
28 changed files with 131 additions and 61 deletions

View file

@ -1,21 +1,13 @@
---
interface Props {
projects: {
name: string,
description: string,
date: Date,
dateVisual?: string,
links: string[]
}[]
}
import { getEntry } from "astro:content";
const { projects } = Astro.props;
const projects = await getEntry("projects", "projects");
let lastYear = 0;
---
<div>
{projects.sort((a, b) => b.date.getTime() - a.date.getTime()).map((project) => {
{projects.data.sort((a, b) => b.date.getTime() - a.date.getTime()).map((project) => {
const isNewYear = project.date.getFullYear() !== lastYear;
lastYear = project.date.getFullYear();