npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@strand-cms/core

v0.3.2

Published

Strand core: content schema, MDX loader, and SEO/GEO generators.

Downloads

298

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/core

Schema (@strand-cms/core/schema)

Zod schemas that define the content contract agents write against:

  • PostFrontmatter — the post contract: slug, title, description (50–160 chars), status; SiteConfig.description is 25–160 (draft/scheduled/published), tags, authors, SEO fields, cited sources, FAQ, and AI-search targeting: contentType (guide/comparison/roundup/news/ explainer), primaryKeyword, and per-article keywords (5–8).
  • AuthorFrontmatter — author entities for E-E-A-T markup.
  • SiteConfig / RoutesConfig — site identity and URL layout, with postPath, postUrl, tagPath, authorPath helpers, and the opt-in generateOgImages flag for theme-generated per-post social cards (off by default — a post with no image source still publishes, just without og:image).
  • SourcePolicy + checkSourcePolicy(sources, policy) — mechanical enforcement of editorial sourcing rules; returns one error string per violating source.
  • TopicsPolicy (site.topics) + indexableTag(tag, postCount, policy) + checkTagPolicy(tags, policy) — mechanical defense against thin tag-page sprawl (v0.3.0). Tag pages that aren't a declared pillar, don't have a cornerstones entry, and sit below indexMinPosts should render noindex,follow; buildSitemap drops them from the sitemap automatically. aliases names known duplicate tags (usa → us) so site validators can warn on them. Omit site.topics entirely for the old index-every-tag behavior.

Each schema is exported as both the Zod value and the inferred TypeScript type.

Client vs server (Next.js)

The @strand-cms/core barrel includes the filesystem loader (node:fs), so it is server-only. Importing it from a "use client" component makes Turbopack try to bundle node:fs for the browser and the app fails at runtime.

  • Client-safe: import { postPath, tagPath, authorPath } from "@strand-cms/core/schema" (SiteConfig, RoutesConfig types too — pure zod, no fs).
  • Server-only: loadPosts / loadPost / loadAuthors / validatePostFile (from @strand-cms/core or @strand-cms/core/server).
  • Pattern: compute link lists in a Server Component (or lib/*.ts server module) and pass plain { href, label } objects into "use client" components. Never import the barrel — or lib/strand.ts if it wraps the loader — from client code.

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 included
  • loadPosts(dir, opts) / loadPost(dir, slug) — parse + validate MDX files; each Post carries 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-level ValidationResults; these back strand validate and the MCP validate_post tool.

SEO generators

import { buildMetadata, postGraph, sitemapXml, buildRss, buildRobots } from "@strand-cms/core";
  • buildMetadata(post, site, routes) — title, description, canonical, per-article keywords, full robots/googlebot preview directives (max-snippet:-1, max-image-preview:large, max-video-preview:-1), ai-content-type / ai-topic hint tags, article:modified_time (from updatedAt, falling back to publishedAt), and OpenGraph + Twitter cards as framework-agnostic PageMetadata. Descriptions are clamped with metaDescription() (Bing SEO/GEO hard window 25–160).
  • metaDescription(text) — word-boundary clamp helper for site/tag/dynamic templates.
  • 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 — the llms.txt index and full-content variant.
  • mdxToMarkdown(body) — strip MDX to clean markdown (source text, not hydrated DOM).
  • renderPostMarkdown(post, …) — the content-negotiated .md version 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.

Crawl surface (hard rule)

Never platform-redirect /robots.txt / /sitemap.xml / /llms.txt across hosts (Bing Soft 404). Use CRAWL_SURFACE_PATHS, isCrawlSurfacePath, and hostCanonicalRedirectUrl from this package inside Next.js proxy.ts. site.url must be an https origin with no trailing slash.