web-docs API Reference

@opentf/web-docs is the documentation- and blog-site toolkit: a config helper, a set of themed components, build-time virtual modules, and Rolldown plugins. For guides, see Packages → web-docs.

Entry points

ImportProvides
@opentf/web-docsComponents (default-exported from the barrel).
@opentf/web-docs/configdefineDocsConfig — the typed config identity helper.
@opentf/web-docs/themeThe default light/dark theme stylesheet.
@opentf/web-docs/navGenerated section map { "/<dir>": tree } (resolved by docsNavPlugin); DocsLayout reads it.
@opentf/web-docs/postsGenerated blog post list (resolved by blogPostsPlugin).
@opentf/web-docs/updatedGenerated { route: ISO } map + editPaths (last-updated plugin).
@opentf/web-docs/buildBuild plugins and helpers (below).

defineDocsConfig(config)

Identity helper that types otfw.config.js. Key fields:

FieldTypeNotes
site.urlstringCanonical origin — required for production docs/blog builds unless --base-url is passed.
docsobjectDocs generator: title, version, logo, github, repoUrl, dir, nav, footer, search, lastUpdated.
blogobjectBlog generator: dir, title, description, lastUpdated.

See Configuration for the full field list.

Components

Themed building blocks, all exported from @opentf/web-docs:

GroupComponents
LayoutDocsLayout, BlogLayout, Navbar, Sidebar, Footer, Breadcrumbs, Pagination, Toc, LastUpdated
ContentCallout, CodeBlock, Tabs, Steps, Table, Cards, Card
SearchSearch, SearchTrigger
BlogPostList, PostCard, PostBanner, PostMeta, ReadingTime
MiscThemeToggle, NavbarLink, NavIcon

Build (@opentf/web-docs/build)

Rolldown plugins + helpers used by the toolchain (registered automatically by @opentf/web-cli from your config):

ExportPurpose
docsNavPluginResolves @opentf/web-docs/nav to the section map (one tree per top-level folder).
blogPostsPlugin / loadPostsResolves @opentf/web-docs/posts; loadPosts is the callable scan.
lastUpdatedPlugin / loadLastUpdatedResolves @opentf/web-docs/updated (git/frontmatter dates + edit paths).
renderBlogFeedRenders the RSS 2.0 feed from the post list.
renderAtomFeedRenders the Atom 1.0 feed from the post list.
renderLlmsTxt / renderLlmsFullTxtRenders compact and full LLM context files from filesystem routes.
indexWithPagefindPost-build hook that indexes the site for search.
You rarely call these directly

@opentf/web-cli wires the plugins up from your otfw.config.js. The exports are documented here for custom build setups.