This commit is contained in:
2026-06-28 19:09:30 +02:00
parent 8b43e14dc7
commit 4817ccff2a
11 changed files with 1715 additions and 1098 deletions
+15 -13
View File
@@ -1,22 +1,24 @@
// @ts-check // @ts-check
import { rehypeHeadingIds } from '@astrojs/markdown-remark' import { unified } from "@astrojs/markdown-remark";
import mdx from '@astrojs/mdx' import mdx from "@astrojs/mdx";
import sitemap from '@astrojs/sitemap' import sitemap from "@astrojs/sitemap";
import svelte from '@astrojs/svelte' import svelte from "@astrojs/svelte";
import { defineConfig } from 'astro/config' import rehypeAutolinkHeadings from "rehype-autolink-headings";
import rehypeAutolinkHeadings from 'rehype-autolink-headings' import { defineConfig } from "astro/config";
import Icons from 'unplugin-icons/vite' import Icons from "unplugin-icons/vite";
import { remarkReadingTime } from './readingTime' import { remarkReadingTime } from "./readingTime";
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({
site: 'https://example.com', site: "https://example.com",
integrations: [mdx(), sitemap(), svelte()], integrations: [mdx(), sitemap(), svelte()],
markdown: { markdown: {
rehypePlugins: [rehypeHeadingIds, [rehypeAutolinkHeadings, { behavior: 'wrap' }]], processor: unified({
remarkPlugins: [remarkReadingTime], rehypePlugins: [[rehypeAutolinkHeadings, { behavior: "wrap" }]],
remarkPlugins: [remarkReadingTime],
}),
}, },
vite: { vite: {
plugins: [Icons({ compiler: 'astro' })], plugins: [Icons({ compiler: "astro" })],
}, },
}) });
+12 -12
View File
@@ -9,26 +9,26 @@
"start": "astro dev" "start": "astro dev"
}, },
"devDependencies": { "devDependencies": {
"@astrojs/check": "^0.9.8", "@astrojs/check": "^0.9.9",
"@astrojs/markdown-remark": "^6.3.11", "@astrojs/markdown-remark": "^7.2.0",
"@astrojs/mdx": "^4.3.14", "@astrojs/mdx": "^7.0.0",
"@astrojs/rss": "^4.0.18", "@astrojs/rss": "^4.0.18",
"@astrojs/sitemap": "^3.7.2", "@astrojs/sitemap": "^3.7.3",
"@astrojs/svelte": "^7.2.5", "@astrojs/svelte": "^9.0.0",
"@fontsource-variable/jost": "^5.2.8", "@fontsource-variable/jost": "^5.2.8",
"@fontsource-variable/playfair-display": "^5.2.8", "@fontsource-variable/playfair-display": "^5.2.8",
"@iconify-json/ion": "^1.2.7", "@iconify-json/ion": "^1.2.7",
"astro": "^5.18.1", "astro": "^7.0.3",
"fuse.js": "^7.3.0", "fuse.js": "^7.4.2",
"mdast-util-to-string": "^4.0.0", "mdast-util-to-string": "^4.0.0",
"reading-time": "^1.5.0", "reading-time": "^1.5.0",
"rehype-autolink-headings": "^7.1.0", "rehype-autolink-headings": "^7.1.0",
"remark-toc": "^9.0.0", "remark-toc": "^9.0.0",
"sass": "^1.99.0", "sass": "^1.101.0",
"sharp": "^0.34.5", "sharp": "^0.35.2",
"svelte": "^5.55.1", "svelte": "^5.56.4",
"typescript": "^6.0.2", "typescript": "^6.0.3",
"unplugin-icons": "^23.0.1" "unplugin-icons": "^23.0.1"
}, },
"packageManager": "pnpm@10.15.0" "packageManager": "pnpm@11.9.0"
} }
+1663 -1046
View File
File diff suppressed because it is too large Load Diff
+4 -6
View File
@@ -1,6 +1,4 @@
ignoredBuiltDependencies: allowBuilds:
- '@parcel/watcher' '@parcel/watcher': false
esbuild: true
onlyBuiltDependencies: sharp: true
- esbuild
- sharp
+1 -1
View File
@@ -4,7 +4,7 @@ const { pathname } = Astro.url
const routes = [ const routes = [
{ name: 'About', href: '/about' }, { name: 'About', href: '/about' },
{ name: 'Projects', href: '/projects' }, // { name: 'Projects', href: '/projects' },
{ name: 'Blog', href: '/blog' }, { name: 'Blog', href: '/blog' },
{ name: 'Rest', href: '/rest' }, { name: 'Rest', href: '/rest' },
] ]
+1 -1
View File
@@ -13,7 +13,7 @@ const { posts } = Astro.props
{ {
posts.map((post) => ( posts.map((post) => (
<li> <li>
<a href={`/blog/${post.slug}`}> <a href={`/blog/${post.id}`}>
<PostPreview {post} /> <PostPreview {post} />
</a> </a>
</li> </li>
+2 -2
View File
@@ -1,6 +1,6 @@
--- ---
import { Picture } from 'astro:assets' import { Picture } from 'astro:assets'
import type { CollectionEntry } from 'astro:content' import { type CollectionEntry, render as renderEntry } from 'astro:content'
import PostAttributes from './PostAttributes.astro' import PostAttributes from './PostAttributes.astro'
import Tags from './Tags.astro' import Tags from './Tags.astro'
@@ -9,7 +9,7 @@ export type Props = {
} }
const { post } = Astro.props const { post } = Astro.props
const { remarkPluginFrontmatter } = await post.render() const { remarkPluginFrontmatter } = await renderEntry(post)
--- ---
<section class:list={{ without: !post.data.coverImage }}> <section class:list={{ without: !post.data.coverImage }}>
@@ -1,13 +1,13 @@
import { defineCollection, z } from 'astro:content' import { defineCollection } from 'astro:content'
import { z } from 'astro/zod'
import { glob } from 'astro/loaders'
const blog = defineCollection({ const blog = defineCollection({
type: 'content', loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/blog' }),
// Type-check frontmatter using a schema
schema: ({ image }) => schema: ({ image }) =>
z.object({ z.object({
title: z.string(), title: z.string(),
description: z.string().optional(), description: z.string().optional(),
// Transform string to Date object
date: z.coerce.date(), date: z.coerce.date(),
updatedDate: z.coerce.date().optional(), updatedDate: z.coerce.date().optional(),
coverImage: image().optional(), coverImage: image().optional(),
@@ -16,11 +16,11 @@ const blog = defineCollection({
}) })
const page = defineCollection({ const page = defineCollection({
type: 'content', loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/page' }),
schema: z.object({ schema: z.object({
title: z.string(), title: z.string(),
date: z.coerce.date(), date: z.coerce.date(),
}), }),
}) })
export const collections = { blog, page } export const collections = { blog, page }
+3 -3
View File
@@ -1,17 +1,17 @@
--- ---
import { getCollection } from 'astro:content' import { getCollection, render as renderEntry } from 'astro:content'
import PageWithTitle from '../layouts/PageWithTitle.astro' import PageWithTitle from '../layouts/PageWithTitle.astro'
export async function getStaticPaths() { export async function getStaticPaths() {
const posts = await getCollection('page') const posts = await getCollection('page')
return posts.map((post) => ({ return posts.map((post) => ({
params: { page: post.slug }, params: { page: post.id },
props: post, props: post,
})) }))
} }
const post = Astro.props const post = Astro.props
const { Content } = await post.render() const { Content } = await renderEntry(post)
--- ---
<PageWithTitle title={post.data.title}> <PageWithTitle title={post.data.title}>
+3 -3
View File
@@ -1,17 +1,17 @@
--- ---
import { getCollection } from 'astro:content' import { getCollection, render as renderEntry } from 'astro:content'
import BlogPost from '../../layouts/BlogPost.astro' import BlogPost from '../../layouts/BlogPost.astro'
export async function getStaticPaths() { export async function getStaticPaths() {
const posts = await getCollection('blog') const posts = await getCollection('blog')
return posts.map((post) => ({ return posts.map((post) => ({
params: { slug: post.slug }, params: { slug: post.id },
props: post, props: post,
})) }))
} }
const post = Astro.props const post = Astro.props
const { Content, headings, remarkPluginFrontmatter } = await post.render() const { Content, headings, remarkPluginFrontmatter } = await renderEntry(post)
--- ---
<BlogPost {...post.data} {headings} readingTime={remarkPluginFrontmatter.readingTime}> <BlogPost {...post.data} {headings} readingTime={remarkPluginFrontmatter.readingTime}>
+5 -5
View File
@@ -1,5 +1,5 @@
--- ---
import { getCollection } from 'astro:content' import { getCollection, render as renderEntry } from 'astro:content'
import PageSearch from '../components/PageSearch.svelte' import PageSearch from '../components/PageSearch.svelte'
import PageWithTitle from '../layouts/PageWithTitle.astro' import PageWithTitle from '../layouts/PageWithTitle.astro'
@@ -9,10 +9,10 @@ const entries: Entry[] = []
const posts = await getCollection('blog') const posts = await getCollection('blog')
for (const post of posts) { for (const post of posts) {
const rendered = await post.render() const rendered = await renderEntry(post)
const text = rendered.remarkPluginFrontmatter.text const text = rendered.remarkPluginFrontmatter.text
entries.push({ entries.push({
url: `/blog/${post.slug}`, url: `/blog/${post.id}`,
type: 'post', type: 'post',
title: post.data.title, title: post.data.title,
text, text,
@@ -22,10 +22,10 @@ for (const post of posts) {
const pages = await getCollection('page') const pages = await getCollection('page')
for (const page of pages) { for (const page of pages) {
const rendered = await page.render() const rendered = await renderEntry(page)
const text = rendered.remarkPluginFrontmatter.text const text = rendered.remarkPluginFrontmatter.text
entries.push({ entries.push({
url: `/${page.slug}`, url: `/${page.id}`,
type: 'page', type: 'page',
title: page.data.title, title: page.data.title,
text, text,