@strand-cms/core
v0.2.0
Published
Strand core: content schema, MDX loader, and SEO/GEO generators.
Maintainers
Readme
@strand-cms/core
The core of Strand, an agent-first publishing system: the validated content schema, the MDX-in-Git loader, and the SEO/GEO generators every Strand site emits. No database, no CMS UI — posts are MDX files with strict frontmatter, and everything here is a pure function over them.
npm install @strand-cms/coreSchema (@strand-cms/core/schema)
Zod schemas that define the content contract agents write against:
PostFrontmatter— the post contract: slug, title, description, status (draft/scheduled/published), tags, authors, SEO fields, cited sources, FAQ, and AI-search targeting:contentType(guide/comparison/roundup/news/explainer),primaryKeyword, and per-articlekeywords(5–8).AuthorFrontmatter— author entities for E-E-A-T markup.SiteConfig/RoutesConfig— site identity and URL layout, withpostPath,postUrl,tagPath,authorPathhelpers, and the opt-ingenerateOgImagesflag for theme-generated per-post social cards (off by default — a post with no image source still publishes, just withoutog:image).SourcePolicy+checkSourcePolicy(sources, policy)— mechanical enforcement of editorial sourcing rules; returns one error string per violating source.
Each schema is exported as both the Zod value and the inferred TypeScript type.
Loader
Filesystem in, typed content out:
import { loadPosts, loadPost, loadAuthors, isLive } from "@strand-cms/core";
const posts = loadPosts("content/posts"); // live posts, newest first
const post = loadPost("content/posts", "my-slug"); // one post, drafts includedloadPosts(dir, opts)/loadPost(dir, slug)— parse + validate MDX files; eachPostcarries frontmatter, body, and computed reading time.loadAuthors(dir)/loadAuthor(dir, id)— author files.isLive(frontmatter)— published, or scheduled with a publish time in the past.validateFrontmatter(data)/validatePostFile(path)— field-levelValidationResults; these backstrand validateand the MCPvalidate_posttool.
SEO generators
import { buildMetadata, postGraph, sitemapXml, buildRss, buildRobots } from "@strand-cms/core";buildMetadata(post, site, routes)— title, description, canonical, per-article keywords, fullrobots/googlebotpreview directives (max-snippet:-1, max-image-preview:large, max-video-preview:-1),ai-content-type/ai-topichint tags,article:modified_time(fromupdatedAt, falling back topublishedAt), and OpenGraph + Twitter cards as framework-agnosticPageMetadata.articleJsonLd/faqJsonLd/breadcrumbJsonLd/websiteJsonLd/postGraph— JSON-LD (Article/NewsArticle/BlogPosting,FAQPage, breadcrumbs) ready to embed.sitemapXml,buildRss,buildRobots— the classic crawl surface.
GEO generators (AI search)
For ChatGPT / Perplexity / Claude / AI Overviews:
buildLlmsTxt/buildLlmsFullTxt— thellms.txtindex and full-content variant.mdxToMarkdown(body)— strip MDX to clean markdown (source text, not hydrated DOM).renderPostMarkdown(post, …)— the content-negotiated.mdversion of a post page.
All generators are deterministic over the MDX, so their output belongs in the static build — emit at build time, rebuild on merge.
Used by
@strand-cms/cli (MCP server +
validation), @strand-cms/content-api
(headless JSON layer), and the default Next.js theme scaffolded by
create-strand.
MIT.
