diff --git a/.github/workflows/astro.yml b/.github/workflows/astro.yml index 0d33785..ddedc5b 100644 --- a/.github/workflows/astro.yml +++ b/.github/workflows/astro.yml @@ -21,10 +21,10 @@ jobs: - name: Checkout your repository using git uses: actions/checkout@v6 - name: Install, build, and upload your site output - uses: withastro/action@v5 + uses: withastro/action@v6 with: # path: . # The root location of your Astro project inside the repository. (optional) - # node-version: 18 # The specific version of Node that should be used to build your site. Defaults to 18. (optional) + # node-version: 24 # The specific version of Node that should be used to build your site. Defaults to 24. (optional) package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional) deploy: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index d0b7dbe..dbb26c8 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,3 +1,3 @@ -onlyBuiltDependencies: - - esbuild - - sharp +allowBuilds: + esbuild: true + sharp: true diff --git a/src/components/ArrowCard.tsx b/src/components/ArrowCard.tsx index 495fa43..7f79fed 100644 --- a/src/components/ArrowCard.tsx +++ b/src/components/ArrowCard.tsx @@ -22,6 +22,11 @@ export default function ArrowCard({ entry, pill }: Props) { )}
{formatDate(entry.data.date)} + {entry.data.updated && ( + + (updated {formatDate(entry.data.updated)}) + + )}
diff --git a/src/components/Blog.tsx b/src/components/Blog.tsx index 462fc3c..f1130a5 100644 --- a/src/components/Blog.tsx +++ b/src/components/Blog.tsx @@ -10,15 +10,25 @@ type Props = { }; export default function Blog({ data, tags }: Props) { + function getDateOfLatestUpdate(entry: CollectionEntry<"blog">) { + return entry.data.updated ?? entry.data.date; + } + function filterPosts(): CollectionEntry<"blog">[] { - return data.filter((entry) => - Array.from(filter()).every((value) => - entry.data.tags.some( - (tag: string) => - tag.toLowerCase() === String(value).toLowerCase(), + return data + .filter((entry) => + Array.from(filter()).every((value) => + entry.data.tags.some( + (tag: string) => + tag.toLowerCase() === String(value).toLowerCase(), + ), ), - ), - ); + ) + .toSorted( + (a, b) => + getDateOfLatestUpdate(b).getTime() - + getDateOfLatestUpdate(a).getTime(), + ); } const [filter, setFilter] = createSignal(new Set()); diff --git a/src/components/Projects.tsx b/src/components/Projects.tsx index 7482de5..713f8d2 100644 --- a/src/components/Projects.tsx +++ b/src/components/Projects.tsx @@ -10,15 +10,25 @@ type Props = { }; export default function Projects({ data, tags }: Props) { + function getDateOfLatestUpdate(entry: CollectionEntry<"projects">) { + return entry.data.updated ?? entry.data.date; + } + function filterProjects(): CollectionEntry<"projects">[] { - return data.filter((entry) => - Array.from(filter()).every((value) => - entry.data.tags.some( - (tag: string) => - tag.toLowerCase() === String(value).toLowerCase(), + return data + .filter((entry) => + Array.from(filter()).every((value) => + entry.data.tags.some( + (tag: string) => + tag.toLowerCase() === String(value).toLowerCase(), + ), ), - ), - ); + ) + .toSorted( + (a, b) => + getDateOfLatestUpdate(b).getTime() - + getDateOfLatestUpdate(a).getTime(), + ); } const [filter, setFilter] = createSignal(new Set()); diff --git a/src/content.config.ts b/src/content.config.ts index 3906822..b11cf74 100644 --- a/src/content.config.ts +++ b/src/content.config.ts @@ -31,6 +31,7 @@ const blog = defineCollection({ title: z.string(), summary: z.string(), date: z.date(), + updated: z.date().optional(), tags: z.array(z.string()), draft: z.boolean().optional(), }), @@ -42,6 +43,7 @@ const projects = defineCollection({ title: z.string(), summary: z.string(), date: z.date(), + updated: z.date().optional(), tags: z.array(z.string()), draft: z.boolean().optional(), demoUrl: z.string().optional(), diff --git a/src/layouts/ArticleTopLayout.astro b/src/layouts/ArticleTopLayout.astro index 1c170d0..b61aaef 100644 --- a/src/layouts/ArticleTopLayout.astro +++ b/src/layouts/ArticleTopLayout.astro @@ -47,6 +47,17 @@ const repoUrl = collection === "projects" ? data.repoUrl : null; {formatDate(date)}
+ { + entry.data.updated && ( +
+ + Updated {formatDate(entry.data.updated)} +
+ ) + }
{readingTime(body ?? "")}