diff --git a/keystatic.config.ts b/keystatic.config.ts index f8a88d8..f750700 100644 --- a/keystatic.config.ts +++ b/keystatic.config.ts @@ -1,19 +1,58 @@ -import { config, fields, collection } from '@keystatic/core'; +import { config, fields, collection, singleton } from '@keystatic/core'; + +// Use GitHub storage in production (when env vars are set), local storage for development +const isProd = import.meta.env.PUBLIC_KEYSTATIC_GITHUB_APP_SLUG; export default config({ - storage: { + storage: isProd ? { kind: 'github', repo: 'YM1KTC/ARC-Web-Sitesi', branch: 'main', - }, + } : undefined, ui: { brand: { name: 'ARC CMS', + mark: () => '', }, navigation: { 'İçerik': ['post'], + 'Ayarlar': ['site'], }, }, + singletons: { + site: singleton({ + label: 'Site Ayarları', + path: 'src/data/site', + schema: { + siteName: fields.text({ + label: 'Site Adı', + default: 'Amatör Radyocular Derneği', + }), + siteDescription: fields.text({ + label: 'Site Açıklaması', + multiline: true, + default: 'Amatör telsizciliği yaygınlaştıran Türkiye\'deki öncü dernek.', + }), + siteUrl: fields.text({ + label: 'Site URL', + default: 'https://radio.org.tr', + }), + contactEmail: fields.text({ + label: 'İletişim E-posta', + default: 'info@radio.org.tr', + }), + socialMedia: fields.object({ + label: 'Sosyal Medya Hesapları', + schema: { + facebook: fields.text({ label: 'Facebook' }), + twitter: fields.text({ label: 'Twitter/X' }), + instagram: fields.text({ label: 'Instagram' }), + youtube: fields.text({ label: 'YouTube' }), + }, + }), + }, + }), + }, collections: { post: collection({ label: 'Blog Yazıları', @@ -23,7 +62,15 @@ export default config({ contentField: 'body', frontmatter: 'yaml', }, - columns: ['title', 'date', 'author'], + previewURL: ({ slug }) => `http://localhost:4321/blog/${slug}`, + columns: ['title', 'date', 'author', 'published', 'featured'], + entryLayout: { + 'Ana Bilgiler': ['title', 'date', 'author', 'published', 'featured'], + 'Medya': ['image'], + 'Sınıflandırma': ['categories', 'tags', 'layout'], + 'Özet': ['excerpt'], + 'İçerik': ['body', 'relatedPosts'], + }, schema: { title: fields.slug({ name: { @@ -40,6 +87,16 @@ export default config({ description: 'Çağrı işareti (örn: TA1SPH) veya yazar adı', default: 'TA1SPH', }), + published: fields.checkbox({ + label: 'Yayınlandı', + description: 'Bu yazı yayınlandı mı?', + defaultValue: true, + }), + featured: fields.checkbox({ + label: 'Öne Çıkan', + description: 'Ana sayfada öne çıkan yazılar', + defaultValue: false, + }), categories: fields.array( fields.text({ label: 'Kategori', @@ -74,6 +131,12 @@ export default config({ description: 'Blog listesinde gösterilecek özet (isteğe bağlı)', multiline: true, }), + relatedPosts: fields.relationship({ + label: 'İlgili Yazılar', + description: 'Bu yazıyla ilgili diğer blog yazıları', + collection: 'post', + validation: { length: { min: 0, max: 5 } }, + }), body: fields.markdoc({ label: 'İçerik', description: 'Blog yazısının ana içeriği (Markdown formatında yazın)', diff --git a/src/content.config.ts b/src/content.config.ts index be14910..0348f79 100644 --- a/src/content.config.ts +++ b/src/content.config.ts @@ -7,11 +7,14 @@ const post = defineCollection({ title: z.string(), date: z.date(), author: z.string().default('TA1SPH'), + published: z.boolean().default(true), + featured: z.boolean().default(false), categories: z.array(z.string()).default([]), tags: z.array(z.string()).default([]), layout: z.string().default('post'), image: z.string().optional(), excerpt: z.string().optional(), + relatedPosts: z.array(z.string()).optional(), }), });