diff --git a/src/content.config.ts b/src/content.config.ts index 81d3095..abeeb2d 100644 --- a/src/content.config.ts +++ b/src/content.config.ts @@ -6,16 +6,17 @@ import { glob } from 'astro/loaders'; // renders them to static HTML at build time. const news = defineCollection({ loader: glob({ pattern: '**/*.md', base: './src/content/news' }), - schema: ({ image }) => - z.object({ - title: z.string(), - description: z.string(), - date: z.coerce.date(), - category: z.string().default('news'), - author: z.string().default('CTAO'), - cover: image().optional(), - draft: z.boolean().default(false), - }), + schema: z.object({ + title: z.string(), + description: z.string(), + date: z.coerce.date(), + category: z.string().default('news'), + author: z.string().default('CTAO'), + // Public-path string, e.g. "/uploads/foo.jpg" — Sveltia uploads media to + // public/uploads, which Astro's image() helper can't validate (src/ only). + cover: z.string().optional(), + draft: z.boolean().default(false), + }), }); export const collections = { news }; diff --git a/src/pages/news/[slug].astro b/src/pages/news/[slug].astro index 51fcbf5..fa2154d 100644 --- a/src/pages/news/[slug].astro +++ b/src/pages/news/[slug].astro @@ -16,6 +16,7 @@ const fmt = (d) => new Intl.DateTimeFormat('pl-PL', { dateStyle: 'long' }).forma ← Wszystkie newsy