feat: upgrade to astro 5

This commit is contained in:
Jayden 2024-12-24 06:20:40 +00:00
parent 47f21f8b3c
commit 0704481e0b
16 changed files with 3976 additions and 2671 deletions

View file

@ -107,7 +107,7 @@ Within the blog itself (as in the layout, appearance, and navigation) are featur
- Theme selectors should be self-explanatory. I've added one on the top right of the header, which is also `sticky` and not `absolute` such that it doesn't ignore the document flow (and thus you won't have to add `mt-20` to the top of every single page).
- The table of contents of a post shouldn't be reduced to a `<details closed>{:html}` at the start of a blog post on desktop. You'd need to go to the top of the page to navigate through items. I've added a sticky `TableOfContents` component which always hangs out around the unused left side margin of a blog post. I also attached a very tiny client-side script using [`IntersectionObserver{:ts}`](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver) to highlight all of the headings you're viewing within the TOC as you scroll through the page&mdash;it also will handle nested headings in that the parent heading of a visible child will still be highlighted even if off-screen (see the dummy [2024 Post](/blog/2024-post) for an example of this). I'll still use a collapsible `<details>{:html}` element for the table of contents on mobile though since obviously a table of contents on the side is unfeasible for small screens.
- Every page, except the homepage, will have a `<Breadcrumb>{:tsx}` component which shows you your current location in the site hierarchy. I don't see these often in blog templates even though they are so amazing for both discoverability (SEO and crawling) and user experience (the user always knows how "deep" they are in the site).
- You can specify multiple post authors via frontmatter. If this post author's slug is found within the `Authors` collection, then it will render particular info from that author's frontmatter file, `[author-name].md` (e.g. avatar, link to profile). For example, the previous post (2024 Post) has two authors: "enscribe" and "jktrn", where "enscribe" is the only author with a custom avatar since "jktrn" is unregistered.
- You can specify multiple post authors via frontmatter. If this post author's id is found within the `Authors` collection, then it will render particular info from that author's frontmatter file, `[author-name].md` (e.g. avatar, link to profile). For example, the previous post (2024 Post) has two authors: "enscribe" and "jktrn", where "enscribe" is the only author with a custom avatar since "jktrn" is unregistered.
- Each author will have their own page, which lists all of their posts. If you're the only author throughout the entire blog then you can simply disregard all aspects regarding both inserting authors and the `Authors` collection.
- Each tag will also have their own page, which lists all of the posts under that tag!
- $\LaTeX$ is fully supported with [KaTeX](https://katex.org/):

View file

@ -1,63 +0,0 @@
import { defineCollection, z } from 'astro:content'
const blog = defineCollection({
type: 'content',
schema: ({ image }) =>
z.object({
title: z
.string()
.max(
60,
'Title should be 60 characters or less for optimal Open Graph display.',
),
description: z
.string()
.max(
155,
'Description should be 155 characters or less for optimal Open Graph display.',
),
date: z.coerce.date(),
image: image()
.refine((img) => img.width === 1200 && img.height === 630, {
message:
'The image must be exactly 1200px × 630px for Open Graph requirements.',
})
.optional(),
tags: z.array(z.string()).optional(),
authors: z.array(z.string()).optional(),
draft: z.boolean().optional(),
}),
})
const authors = defineCollection({
type: 'content',
schema: z.object({
name: z.string(),
pronouns: z.string().optional(),
avatar: z.string().url(),
bio: z.string().optional(),
mail: z.string().email().optional(),
website: z.string().url().optional(),
twitter: z.string().url().optional(),
github: z.string().url().optional(),
linkedin: z.string().url().optional(),
discord: z.string().url().optional(),
}),
})
const projects = defineCollection({
type: 'content',
schema: ({ image }) =>
z.object({
name: z.string(),
description: z.string(),
tags: z.array(z.string()),
image: image().refine((img) => img.width === 1200 && img.height === 630, {
message:
'The image must be exactly 1200px × 630px for Open Graph requirements.',
}),
link: z.string().url(),
}),
})
export const collections = { blog, authors, projects }