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
| Import | Provides |
|---|---|
@opentf/web-docs | Components (default-exported from the barrel). |
@opentf/web-docs/config | defineDocsConfig — the typed config identity helper. |
@opentf/web-docs/theme | The default light/dark theme stylesheet. |
@opentf/web-docs/nav | Generated section map { "/<dir>": tree } (resolved by docsNavPlugin); DocsLayout reads it. |
@opentf/web-docs/posts | Generated blog post list (resolved by blogPostsPlugin). |
@opentf/web-docs/updated | Generated { route: ISO } map + editPaths (last-updated plugin). |
@opentf/web-docs/build | Build plugins and helpers (below). |
defineDocsConfig(config)
Identity helper that types otfw.config.js. Key fields:
| Field | Type | Notes |
|---|---|---|
site.url | string | Canonical origin — required for production docs/blog builds unless --base-url is passed. |
docs | object | Docs generator: title, version, logo, github, repoUrl, dir, nav, footer, search, lastUpdated. |
blog | object | Blog generator: dir, title, description, lastUpdated. |
See Configuration for the full field list.
Components
Themed building blocks, all exported from @opentf/web-docs:
| Group | Components |
|---|---|
| Layout | DocsLayout, BlogLayout, Navbar, Sidebar, Footer, Breadcrumbs, Pagination, Toc, LastUpdated |
| Content | Callout, CodeBlock, Tabs, Steps, Table, Cards, Card |
| Search | Search, SearchTrigger |
| Blog | PostList, PostCard, PostBanner, PostMeta, ReadingTime |
| Misc | ThemeToggle, NavbarLink, NavIcon |
Build (@opentf/web-docs/build)
Rolldown plugins + helpers used by the toolchain (registered automatically by @opentf/web-cli from your config):
| Export | Purpose |
|---|---|
docsNavPlugin | Resolves @opentf/web-docs/nav to the section map (one tree per top-level folder). |
blogPostsPlugin / loadPosts | Resolves @opentf/web-docs/posts; loadPosts is the callable scan. |
lastUpdatedPlugin / loadLastUpdated | Resolves @opentf/web-docs/updated (git/frontmatter dates + edit paths). |
renderBlogFeed | Renders the RSS 2.0 feed from the post list. |
renderAtomFeed | Renders the Atom 1.0 feed from the post list. |
renderLlmsTxt / renderLlmsFullTxt | Renders compact and full LLM context files from filesystem routes. |
indexWithPagefind | Post-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.