Compare commits

2 Commits

Author SHA1 Message Date
YouHaveTrouble 712ac88b89 update workflows 2026-08-09 09:27:04 +02:00
YouHaveTrouble 888c3c5ca6 update astro 2026-08-09 09:25:13 +02:00
10 changed files with 2714 additions and 3963 deletions
+2 -2
View File
@@ -19,11 +19,11 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout your repository using git - name: Checkout your repository using git
uses: actions/checkout@v4 uses: actions/checkout@v7.0.1
- name: Install, build, and upload your site - name: Install, build, and upload your site
uses: withastro/action@v2 uses: withastro/action@v2
with: with:
node-version: 22 node-version: 24
deploy: deploy:
needs: build needs: build
+2672 -3922
View File
File diff suppressed because it is too large Load Diff
+11 -12
View File
@@ -9,19 +9,18 @@
"astro": "astro" "astro": "astro"
}, },
"dependencies": { "dependencies": {
"@astrojs/mdx": "^3.1.6", "@astrojs/mdx": "^7.0.5",
"@astrojs/rss": "^4.0.7", "@astrojs/rss": "^4.0.19",
"@astrojs/svelte": "^5.7.0", "astro": "^7.2.0",
"astro": "^4.15.6", "markdown-it": "^15.0.0",
"markdown-it": "^14.1.0", "marked": "^18.0.9",
"marked": "^14.1.2",
"reading-time": "^1.5.0", "reading-time": "^1.5.0",
"rehype-external-links": "^3.0.0", "rehype-external-links": "^3.0.0",
"remark-gfm": "^4.0.0", "remark-gfm": "^4.0.1",
"remark-smartypants": "^2.1.0", "remark-smartypants": "^3.0.3",
"sanitize-html": "^2.13.0", "sanitize-html": "^2.17.6",
"sass": "^1.78.0", "sass": "^1.102.0",
"sharp": "^0.34.4", "sharp": "^0.35.3",
"zod": "^3.23.8" "zod": "^4.4.3"
} }
} }
+1 -1
View File
@@ -43,7 +43,7 @@ projects.sort((a, b) => a.data.name.localeCompare(b.data.name));
<span>{project.data.description}</span> <span>{project.data.description}</span>
<span class="links"> <span class="links">
{ {
project.data.links.map((link) => { project.data.links.map((link: {url: string, text: string}) => {
return ( return (
<span> <span>
<a href={link.url} target="_blank">{link.text}</a> <a href={link.url} target="_blank">{link.text}</a>
@@ -1,7 +1,9 @@
import {z, defineCollection} from 'astro:content'; import {defineCollection} from 'astro:content';
import { glob } from "astro/loaders";
import { z } from 'astro/zod';
const posts = defineCollection({ const posts = defineCollection({
type: 'content', loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: "./src/content/posts" }),
schema: z.object({ schema: z.object({
title: z.string(), title: z.string(),
description: z.string(), description: z.string(),
@@ -11,7 +13,7 @@ const posts = defineCollection({
}), }),
}); });
const projects = defineCollection({ const projects = defineCollection({
type: 'content', loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: "./src/content/projects" }),
schema: z.object({ schema: z.object({
category: z.string(), category: z.string(),
name: z.string(), name: z.string(),
@@ -22,7 +24,7 @@ const projects = defineCollection({
}), }),
}); });
const writing = defineCollection({ const writing = defineCollection({
type: 'content', loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: "./src/content/writing" }),
schema: z.object({ schema: z.object({
title: z.string(), title: z.string(),
publishDate: z.date({coerce: true}), publishDate: z.date({coerce: true}),
+7 -7
View File
@@ -1,5 +1,5 @@
--- ---
import {type CollectionEntry, getCollection} from "astro:content"; import {type CollectionEntry, getCollection, render} from "astro:content";
import BaseLayout from '../../layouts/BaseLayout.astro'; import BaseLayout from '../../layouts/BaseLayout.astro';
import Bio from '../../components/Bio.astro'; import Bio from '../../components/Bio.astro';
import readingTime from 'reading-time'; import readingTime from 'reading-time';
@@ -8,15 +8,15 @@ export async function getStaticPaths() {
const posts = await getCollection('posts'); const posts = await getCollection('posts');
return posts.map(p => ({ return posts.map(p => ({
params: { params: {
slug: p.slug slug: p.id
}, },
props: { props: {
title: p.data.title, title: p.data.title,
description: p.data.description, description: p.data.description,
publishDate: p.data.publishDate, publishDate: p.data.publishDate,
slug: p.slug, slug: p.id,
tags: p.data.tags, tags: p.data.tags,
readTime: readingTime(p.body).text, readTime: readingTime(p.body ?? "").text,
}, },
})); }));
} }
@@ -24,9 +24,9 @@ export async function getStaticPaths() {
const {slug, title, description, publishDate, tags, readTime} = Astro.props; const {slug, title, description, publishDate, tags, readTime} = Astro.props;
const permalink = `${Astro?.site?.href}blog/${slug}`; const permalink = `${Astro?.site?.href}blog/${slug}`;
const posts = await getCollection('posts'); const posts = await getCollection('posts');
const entry: CollectionEntry<'posts'> | undefined = posts.find(e => e.slug === slug); const entry: CollectionEntry<'posts'> | undefined = posts.find(e => e.id === slug);
if (!entry) throw new Error(`Post not found: ${slug}`); if (!entry) throw new Error(`Post not found: ${slug}`);
const { Content } = await entry.render(); const { Content } = await render(entry);
--- ---
<BaseLayout title={title} description={description} permalink={permalink} current="blog"> <BaseLayout title={title} description={description} permalink={permalink} current="blog">
@@ -34,7 +34,7 @@ const { Content } = await entry.render();
<p>{publishDate} ~ {readTime}</p> <p>{publishDate} ~ {readTime}</p>
<h1 style={`view-transition-name: blog-post-${slug}`}>{title}</h1> <h1 style={`view-transition-name: blog-post-${slug}`}>{title}</h1>
<div class="tags" style="justify-content: center"> <div class="tags" style="justify-content: center">
{tags.map(item => ( {tags.map((item: string) => (
<span class="tag">{item}</span> <span class="tag">{item}</span>
))} ))}
</div> </div>
+3 -3
View File
@@ -15,16 +15,16 @@ const allPosts= posts.sort((a, b) => new Date(b.data.publishDate).valueOf() - ne
<h1>Blog</h1> <h1>Blog</h1>
{allPosts.length === 0 && <p>No posts as of yet, hop back later!</p>} {allPosts.length === 0 && <p>No posts as of yet, hop back later!</p>}
{allPosts.map((post, index) => { {allPosts.map((post, index) => {
const href = `/blog/${post.slug}`; const href = `/blog/${post.id}`;
return ( return (
<div> <div>
{ index !== 0 && <hr /> } { index !== 0 && <hr /> }
<div class="post-item"> <div class="post-item">
<h2> <h2>
<a data-astro-prefetch href={href} style={`view-transition-name: blog-post-${post.slug}`}>{post.data.title}</a> <a data-astro-prefetch href={href} style={`view-transition-name: blog-post-${post.id}`}>{post.data.title}</a>
</h2> </h2>
<div class="tags"> <div class="tags">
{post.data.tags.map(item => ( {post.data.tags.map((item: string) => (
<span class="tag">{item}</span> <span class="tag">{item}</span>
))} ))}
</div> </div>
+2 -2
View File
@@ -64,13 +64,13 @@ const latestBlogPost = await getCollection("posts")
) : null ) : null
} }
<div class="latest-article"> <div class="latest-article">
<span class="title" style={`view-transition-name: blog-post-${latestBlogPost?.slug}`}>{latestBlogPost?.data.title}</span> <span class="title" style={`view-transition-name: blog-post-${latestBlogPost?.id}`}>{latestBlogPost?.data.title}</span>
<span class="excerpt">{latestBlogPost?.data.description}</span> <span class="excerpt">{latestBlogPost?.data.description}</span>
</div> </div>
<div class="actions"> <div class="actions">
{ {
latestBlogPost !== null && ( latestBlogPost !== null && (
<a href={`/blog/${latestBlogPost?.slug}`} class="button">Read more</a> <a href={`/blog/${latestBlogPost?.id}`} class="button">Read more</a>
<a href="/blog" class="button secondary">All articles</a> <a href="/blog" class="button secondary">All articles</a>
) )
} }
+2 -2
View File
@@ -11,8 +11,8 @@ export async function GET(context: { site: any; }) {
description: 'Something that\'s supposed to be thoughts.', description: 'Something that\'s supposed to be thoughts.',
site: context.site, site: context.site,
items: posts.map((post) => ({ items: posts.map((post) => ({
link: `/blog/${post.slug}/`, link: `/blog/${post.id}/`,
content: sanitizeHtml(marked.parse(post.body), { content: sanitizeHtml(marked.parse(post.body ?? ""), {
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img']) allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img'])
}), }),
pubDate: new Date(post.data.publishDate), pubDate: new Date(post.data.publishDate),
+5 -5
View File
@@ -1,5 +1,5 @@
--- ---
import {type CollectionEntry, getCollection} from "astro:content"; import {type CollectionEntry, getCollection, render} from "astro:content";
import BaseLayout from "../../layouts/BaseLayout.astro"; import BaseLayout from "../../layouts/BaseLayout.astro";
export async function getStaticPaths() { export async function getStaticPaths() {
@@ -7,11 +7,11 @@ export async function getStaticPaths() {
const posts = await getCollection('writing'); const posts = await getCollection('writing');
return posts.map(p => ({ return posts.map(p => ({
params: { params: {
slug: p.slug slug: p.id
}, },
props: { props: {
title: p.data.title, title: p.data.title,
slug: p.slug, slug: p.id,
}, },
})); }));
} }
@@ -19,9 +19,9 @@ export async function getStaticPaths() {
const {slug, title} = Astro.props; const {slug, title} = Astro.props;
const permalink = `${Astro?.site?.href}writing/${slug}`; const permalink = `${Astro?.site?.href}writing/${slug}`;
const writing = await getCollection('writing'); const writing = await getCollection('writing');
const entry: CollectionEntry<'writing'> | undefined = writing.find(e => e.slug === slug); const entry: CollectionEntry<'writing'> | undefined = writing.find(e => e.id === slug);
if (!entry) throw new Error(`Entry not found: ${slug}`); if (!entry) throw new Error(`Entry not found: ${slug}`);
const { Content } = await entry.render(); const { Content } = await render(entry);
--- ---
<BaseLayout title={title} description={""} permalink={permalink} current="writing"> <BaseLayout title={title} description={""} permalink={permalink} current="writing">
<header> <header>