feat(core): dynamic custom frontmatter fields for CTF writeup metadata
CI / typecheck + build (turbo) (push) Canceled after 0s
CI / typecheck + build (turbo) (push) Canceled after 0s
- Add extra_fields JSONB column to documents table (migration 0003) - CreateDocInput/UpdateDocInput: extraFields?: Record<string, string> - parseFile: extracts non-standard frontmatter keys as extraFields - stringifyFile: writes extraFields dynamically to YAML frontmatter - toMeta: spreads extraFields from DB row into DocumentMeta - DocForm: '+ Add field' UI for content creators to add any metadata - API routes: splitPayload() separates standard vs custom fields - Doc page: CustomFieldBadges dynamically renders any custom field - Add db:migrate / db:push scripts + deploy workflow migration step - Add CTF writeup template (content/writeups/ctf/template/) - Add sample DEF CON writeup with event/challenge/category/difficulty/points - Add @tailwindcss/typography for table rendering (prose classes) - Add remark-gfm for GitHub Flavored Markdown table parsing
This commit is contained in:
@@ -14,6 +14,15 @@ export interface DocumentMeta {
|
||||
path: string; // relative path under content/
|
||||
createdAt: string; // ISO
|
||||
updatedAt: string; // ISO
|
||||
// CTF writeup metadata (optional — only set for writeups)
|
||||
event?: string;
|
||||
challenge?: string;
|
||||
category?: string;
|
||||
difficulty?: "easy" | "medium" | "hard";
|
||||
points?: number;
|
||||
// Dynamic custom frontmatter fields (serialized as-is to YAML frontmatter).
|
||||
// Allows content creators to add arbitrary metadata keys without code changes.
|
||||
extraFields?: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface Document extends DocumentMeta {
|
||||
|
||||
Reference in New Issue
Block a user