citeon-connect
v0.2.3
Published
Citeon Connect core: fetch published pieces, AI-readiness files, report AI reads. Used by citeon-astro and citeon-next.
Readme
citeon-connect
Core client for Citeon Connect. You normally do not install this directly: use citeon-astro or citeon-next, which depend on it. Use it only for another framework.
import { getPosts, getPost, getFiles, reportRead, isAiAgent, pulseSnippet } from "citeon-connect";
const o = { siteKey: "pk_…", siteUrl: "https://example.com" };
const posts = await getPosts(o); // published pieces (html, description, image, publishedAt, jsonLd)
const post = await getPost(o, "my-slug"); // one piece or null
const files = await getFiles(o); // { llmsTxt, schemaJsonLd, robotsTxt }
await reportRead(o, { url, userAgent, ip }); // no-op for humans; reports AI fetchers (ChatGPT-User, Perplexity-User, Claude-User, …)
const entries = await sitemapEntries(o); // [{ url, lastModified }]Fetches never throw: 8 s timeout, one retry, 60 s in-memory cache (bypassed when Next owns caching), stale beats broken. Pass { strict: true } as the third argument to make a static build fail loudly instead.
Everything fetched is public content of the connected site. The site key identifies the site; it is not a secret. MIT.
