Initial commit: Astro 6 static blog site
All checks were successful
Deploy / deploy (push) Successful in 49s
All checks were successful
Deploy / deploy (push) Successful in 49s
- German (default) and English i18n support - Categories and tags - Blog posts with hero images - Dark/light theme switcher - View Transitions removed to fix reload ghost images - Webmentions integration - RSS feeds per locale Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
commit
5bb63bacf5
95 changed files with 12199 additions and 0 deletions
42
src/content.config.ts
Normal file
42
src/content.config.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import { defineCollection, reference } from 'astro:content';
|
||||
import { glob } from 'astro/loaders';
|
||||
import { z } from 'astro/zod';
|
||||
|
||||
// Shared per-locale layout:
|
||||
// src/content/posts/<locale>/… — posts
|
||||
// src/content/categories/<locale>/… — categories
|
||||
// Entry `id` is always `<locale>/<slug>`. A blog post's `category` references a
|
||||
// category by that id (e.g. "de/technik" or "en/tech").
|
||||
|
||||
// Optional `translationKey`: entries in different locales that represent the
|
||||
// same logical piece of content share one key. Used to wire up the language
|
||||
// switcher so it points at the translated URL instead of 404-ing.
|
||||
|
||||
const posts = defineCollection({
|
||||
loader: glob({ base: './src/content/posts', pattern: '{de,en}/**/*.{md,mdx}' }),
|
||||
schema: ({ image }) =>
|
||||
z.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
pubDate: z.coerce.date(),
|
||||
updatedDate: z.coerce.date().optional(),
|
||||
heroImage: z.optional(image()),
|
||||
category: z.optional(reference('categories')),
|
||||
// Free-form tags (aka Stichwörter). Plain strings kept inline on each
|
||||
// post; no separate collection. The tag listing pages aggregate them
|
||||
// across posts per locale.
|
||||
tags: z.array(z.string()).optional(),
|
||||
translationKey: z.string().optional(),
|
||||
}),
|
||||
});
|
||||
|
||||
const categories = defineCollection({
|
||||
loader: glob({ base: './src/content/categories', pattern: '{de,en}/**/*.md' }),
|
||||
schema: z.object({
|
||||
name: z.string(),
|
||||
description: z.string().optional(),
|
||||
translationKey: z.string().optional(),
|
||||
}),
|
||||
});
|
||||
|
||||
export const collections = { posts, categories };
|
||||
Loading…
Add table
Add a link
Reference in a new issue