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
import { rehypeHeadingIds } from '@astrojs/markdown-remark'
import mdx from '@astrojs/mdx'
import sitemap from '@astrojs/sitemap'
import svelte from '@astrojs/svelte'
import { defineConfig } from 'astro/config'
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
import Icons from 'unplugin-icons/vite'
import { remarkReadingTime } from './readingTime'
import { unified } from "@astrojs/markdown-remark";
import mdx from "@astrojs/mdx";
import sitemap from "@astrojs/sitemap";
import svelte from "@astrojs/svelte";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import { defineConfig } from "astro/config";
import Icons from "unplugin-icons/vite";
import { remarkReadingTime } from "./readingTime";
// https://astro.build/config
export default defineConfig({
site: 'https://example.com',
site: "https://example.com",
integrations: [mdx(), sitemap(), svelte()],
markdown: {
rehypePlugins: [rehypeHeadingIds, [rehypeAutolinkHeadings, { behavior: 'wrap' }]],
remarkPlugins: [remarkReadingTime],
processor: unified({
rehypePlugins: [[rehypeAutolinkHeadings, { behavior: "wrap" }]],
remarkPlugins: [remarkReadingTime],
}),
},
vite: {
plugins: [Icons({ compiler: 'astro' })],
plugins: [Icons({ compiler: "astro" })],
},
})
});
+12 -12
View File
@@ -9,26 +9,26 @@
"start": "astro dev"
},
"devDependencies": {
"@astrojs/check": "^0.9.8",
"@astrojs/markdown-remark": "^6.3.11",
"@astrojs/mdx": "^4.3.14",
"@astrojs/check": "^0.9.9",
"@astrojs/markdown-remark": "^7.2.0",
"@astrojs/mdx": "^7.0.0",
"@astrojs/rss": "^4.0.18",
"@astrojs/sitemap": "^3.7.2",
"@astrojs/svelte": "^7.2.5",
"@astrojs/sitemap": "^3.7.3",
"@astrojs/svelte": "^9.0.0",
"@fontsource-variable/jost": "^5.2.8",
"@fontsource-variable/playfair-display": "^5.2.8",
"@iconify-json/ion": "^1.2.7",
"astro": "^5.18.1",
"fuse.js": "^7.3.0",
"astro": "^7.0.3",
"fuse.js": "^7.4.2",
"mdast-util-to-string": "^4.0.0",
"reading-time": "^1.5.0",
"rehype-autolink-headings": "^7.1.0",
"remark-toc": "^9.0.0",
"sass": "^1.99.0",
"sharp": "^0.34.5",
"svelte": "^5.55.1",
"typescript": "^6.0.2",
"sass": "^1.101.0",
"sharp": "^0.35.2",
"svelte": "^5.56.4",
"typescript": "^6.0.3",
"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:
- '@parcel/watcher'
onlyBuiltDependencies:
- esbuild
- sharp
allowBuilds:
'@parcel/watcher': false
esbuild: true
sharp: true
+1 -1
View File
@@ -4,7 +4,7 @@ const { pathname } = Astro.url
const routes = [
{ name: 'About', href: '/about' },
{ name: 'Projects', href: '/projects' },
// { name: 'Projects', href: '/projects' },
{ name: 'Blog', href: '/blog' },
{ name: 'Rest', href: '/rest' },
]
+1 -1
View File
@@ -13,7 +13,7 @@ const { posts } = Astro.props
{
posts.map((post) => (
<li>
<a href={`/blog/${post.slug}`}>
<a href={`/blog/${post.id}`}>
<PostPreview {post} />
</a>
</li>
+2 -2
View File
@@ -1,6 +1,6 @@
---
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 Tags from './Tags.astro'
@@ -9,7 +9,7 @@ export type Props = {
}
const { post } = Astro.props
const { remarkPluginFrontmatter } = await post.render()
const { remarkPluginFrontmatter } = await renderEntry(post)
---
<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({
type: 'content',
// Type-check frontmatter using a schema
loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/blog' }),
schema: ({ image }) =>
z.object({
title: z.string(),
description: z.string().optional(),
// Transform string to Date object
date: z.coerce.date(),
updatedDate: z.coerce.date().optional(),
coverImage: image().optional(),
@@ -16,11 +16,11 @@ const blog = defineCollection({
})
const page = defineCollection({
type: 'content',
loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/page' }),
schema: z.object({
title: z.string(),
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'
export async function getStaticPaths() {
const posts = await getCollection('page')
return posts.map((post) => ({
params: { page: post.slug },
params: { page: post.id },
props: post,
}))
}
const post = Astro.props
const { Content } = await post.render()
const { Content } = await renderEntry(post)
---
<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'
export async function getStaticPaths() {
const posts = await getCollection('blog')
return posts.map((post) => ({
params: { slug: post.slug },
params: { slug: post.id },
props: post,
}))
}
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}>
+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 PageWithTitle from '../layouts/PageWithTitle.astro'
@@ -9,10 +9,10 @@ const entries: Entry[] = []
const posts = await getCollection('blog')
for (const post of posts) {
const rendered = await post.render()
const rendered = await renderEntry(post)
const text = rendered.remarkPluginFrontmatter.text
entries.push({
url: `/blog/${post.slug}`,
url: `/blog/${post.id}`,
type: 'post',
title: post.data.title,
text,
@@ -22,10 +22,10 @@ for (const post of posts) {
const pages = await getCollection('page')
for (const page of pages) {
const rendered = await page.render()
const rendered = await renderEntry(page)
const text = rendered.remarkPluginFrontmatter.text
entries.push({
url: `/${page.slug}`,
url: `/${page.id}`,
type: 'page',
title: page.data.title,
text,