OOKNET                             [ /  search the index  ]  
──────────────────────────────────────────────────────────────────────────────────────
══════════════════════════════════════════════════════════════════════════════════════
OOKNET   [ /  search  ]  
────────────────────────────────────────────────
════════════════════════════════════════════════
 
 
master @ 28 LINES
 
[ HISTORY ]  [ UP ]
 

import { defineCollection, z } from "astro:content";
import { glob } from "astro/loaders";

// One collection: the knowledge base. What a page IS - personal note,
// project documentation, vendor reference - is declared by the nearest
// dir.yml above it (see lib/registers.ts), not by where it lives in
// the url. The schema stays permissive: only title is required, and
// register-specific fields (published for notes, source/url/retrieved
// for reference, order for docs) apply where the register wants them.
const kb = defineCollection({
  loader: glob({ pattern: "**/*.md", base: "./src/content/kb" }),
  schema: z.object({
    title: z.string(),
    published: z.string().optional(),   // ISO date - notes
    status: z.string().optional(),      // notes
    tags: z.array(z.string()).default([]),
    seeAlso: z.array(z.string()).optional(),
    description: z.string().optional(), // docs
    order: z.number().optional(),       // docs
    source: z.string().optional(),      // reference: vendor name
    url: z.string().optional(),         // reference
    retrieved: z.string().optional(),   // reference: ISO date
    draft: z.boolean().default(false),
  }),
});

export const collections = { kb };

import { defineCollection, z } from "astro:c
ontent";
import { glob } from "astro/loaders";

// One collection: the knowledge base. What 
a page IS - personal note,
// project documentation, vendor reference -
 is declared by the nearest
// dir.yml above it (see lib/registers.ts), 
not by where it lives in
// the url. The schema stays permissive: onl
y title is required, and
// register-specific fields (published for n
otes, source/url/retrieved
// for reference, order for docs) apply wher
e the register wants them.
const kb = defineCollection({
  loader: glob({ pattern: "**/*.md", base: "
./src/content/kb" }),
  schema: z.object({
    title: z.string(),
    published: z.string().optional(),   // I
SO date - notes
    status: z.string().optional(),      // n
otes
    tags: z.array(z.string()).default([]),
    seeAlso: z.array(z.string()).optional(),
    description: z.string().optional(), // d
ocs
    order: z.number().optional(),       // d
ocs
    source: z.string().optional(),      // r
eference: vendor name
    url: z.string().optional(),         // r
eference
    retrieved: z.string().optional(),   // r
eference: ISO date
    draft: z.boolean().default(false),
  }),
});

export const collections = { kb };
 
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET