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

// Personal writing only: kb pages whose register is notes, newest
// first. Docs and reference copies stay out of the feed.
import type { APIRoute } from "astro";
import { getCollection } from "astro:content";
import { published, topSegment } from "../lib/notes";
import { readManifests, registerOf } from "../lib/registers";
import { describeBody } from "../lib/meta";
import { buildRss } from "../lib/feeds";

export const GET: APIRoute = async ({ site }) => {
  const manifests = readManifests();
  const notes = (await getCollection("kb", published))
    .filter((e) => registerOf(e.id, manifests).register === "notes" && e.data.publ
ished)
    .sort((a, b) => b.data.published!.localeCompare(a.data.published!));
  const xml = buildRss({
    title: "OOKNET KB",
    site: site!.href,
    description: "OOKNET notes - personal writing, filed by subject.",
    items: notes.map((n) => ({
      title: n.data.title,
      url: new URL(`/kb/${n.id}/`, site).href,
      published: n.data.published!,
      description: describeBody(n.body ?? "") || `Note filed under ${topSegment(n.
id)}.`,
    })),
  });
  return new Response(xml, {
    headers: { "Content-Type": "application/rss+xml; charset=utf-8" },
  });
};

// Personal writing only: kb pages whose reg
ister is notes, newest
// first. Docs and reference copies stay out
 of the feed.
import type { APIRoute } from "astro";
import { getCollection } from "astro:content
";
import { published, topSegment } from "../li
b/notes";
import { readManifests, registerOf } from ".
./lib/registers";
import { describeBody } from "../lib/meta";
import { buildRss } from "../lib/feeds";

export const GET: APIRoute = async ({ site }
) => {
  const manifests = readManifests();
  const notes = (await getCollection("kb", p
ublished))
    .filter((e) => registerOf(e.id, manifest
s).register === "notes" && e.data.published)
    .sort((a, b) => b.data.published!.locale
Compare(a.data.published!));
  const xml = buildRss({
    title: "OOKNET KB",
    site: site!.href,
    description: "OOKNET notes - personal wr
iting, filed by subject.",
    items: notes.map((n) => ({
      title: n.data.title,
      url: new URL(`/kb/${n.id}/`, site).hre
f,
      published: n.data.published!,
      description: describeBody(n.body ?? ""
) || `Note filed under ${topSegment(n.id)}.`
,
    })),
  });
  return new Response(xml, {
    headers: { "Content-Type": "application/
rss+xml; charset=utf-8" },
  });
};
 
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET