import path from "path"; import { fileURLToPath } from "url"; import type { CollectionConfig } from "payload"; import { isAdmin } from "@/access"; const dirname = path.dirname(fileURLToPath(import.meta.url)); export const Media: CollectionConfig = { slug: "media", labels: { singular: "Bild", plural: "Bilder", }, admin: { useAsTitle: "alt", description: "Bilder für die Website — Alt-Text ist für Barrierefreiheit und SEO Pflicht.", }, access: { // Images are public so the website can display them without a login. read: () => true, create: isAdmin, update: isAdmin, delete: isAdmin, }, upload: { staticDir: path.resolve(dirname, "..", "media"), // SVG deliberately excluded: it can carry inline